悬停项目与JQuery [英] Hover Item with JQuery

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

问题描述

有没有办法使用javascript悬停一个元素?
我不想创建另一个类,我只是希望当鼠标指针不在该元素上时使元素悬停在javascript中。



例如,我有5个元素具有相同的类,并且当其中一个实际上被徘徊时,我希望将其悬停在所有这些元素上。 解决方案

我假设你是指你已经与链接关联的伪类:hover (例如)。当您将鼠标悬停在该链接上时,您想要调用所有其他链接的:hover 样式。



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


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.

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.

解决方案

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.

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆