使用 JQuery 悬停项目

Hover Item with JQuery(使用 JQuery 悬停项目)

本文介绍了使用 JQuery 悬停项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用 javascript 来悬停元素?我不想创建另一个类,我只想在我的鼠标指针不在该元素上时使元素悬停在 javascript 上.

Is there a way to hover an element using javascript? I don't want to create another class, I just want to cause element to hover with javascript when my mouse pointer is not over that element.

例如,我有 5 个具有相同类的元素,当其中一个元素实际悬停时,我想在所有元素上调用悬停.

For example I have 5 elements with the same class and I want to call hover on all of them when one of them is actually hovered.

推荐答案

我假设您的意思是与链接关联的伪类 :hover(例如).当您将鼠标悬停在该链接上时,您希望调用所有其他链接的 :hover 样式.

I assume you mean the pseudo class :hover that you've associated with a link (for example). As you hover over that link, you want to invoke all other link's :hover styles.

不幸的是,您不能从 jQuery 调用 :hover 样式,这需要您将鼠标指针实际移动到该元素上.您必须使用类并利用 jQuery 的悬停事件.

Unfortunately, you can not invoke the :hover styles from jQuery, that requires that you actually move your mouse pointer over that element. You have to use classes and utilize jQuery's hover event.

这篇关于使用 JQuery 悬停项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:使用 JQuery 悬停项目

基础教程推荐