用jQuery覆盖a:hover? [英] Override a:hover with jQuery?

查看:179
本文介绍了用jQuery覆盖a:hover?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用CSS定义了<a>标记.我试图停止对a标记的默认样式表:hover进行更改.如何在Jquery中的a标签上禁用悬停更改?

I have defined an <a> tag with css. I'm trying to stop default stylesheet :hover changes on the a tag. How do I disable the hover changes on the a tag in Jquery?

推荐答案

以下解决方案的实时演示: http://jsbin .com/umiru

Live demo of the following solution: http://jsbin.com/umiru

-

我想到的最简单的方法就是更改:

The easiest way I can think of is to change:

a:hover { ... }

进入

a.someClass:hover { ... }

然后通过jQuery的方法添加/删除.someClass:

And then add/remove .someClass via jQuery's methods:

$(this).addClass("someClass");    // activates css rules for :hover
$(this).removeClass("someClass"); // deactivates css rules for :hover

这篇关于用jQuery覆盖a:hover?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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