Hover Item with 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 悬停项目


基础教程推荐
- npm start 错误与 create-react-app 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01