如何在js函数中添加:hover规则?
我为我的网站修改了一些 jQuery 幻灯片库。我想在css中添加 .nav li a:hover{color:#00f;}
,但它不起作用。我在firebug中检查了它,css规则被划掉了。我在jquery幻灯片厨房的js文件中找到了一些东西,如下所示:
function init(){
g.find(".nav").children("li").css("margin","0").css("padding","5px");
g.find(".nav").children("li").children("a").css("text-decoration","none").css("display","block");
}
是否应该在js文件中添加a:hover css规则?如何添加呢?谢谢。
I modified some jQuery slide gallery for my website. And I want to add .nav li a:hover{color:#00f;}
in css, but it didn't work. I checked it in firebug, the css rule is be crossed off. I find something in the jquery slide galley's js file,like this:
function init(){
g.find(".nav").children("li").css("margin","0").css("padding","5px");
g.find(".nav").children("li").children("a").css("text-decoration","none").css("display","block");
}
Is it should be add the a:hover css rule in the js files? How to add it? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 JS 中执行此操作,
您还可以修改插件样式表,这样您就不必覆盖它。
You can do this in JS with
You could also modify the plugin stylesheet so you wouldn't have to override it.
一段时间后它会变得一团糟,但是您可以使用 使 CSS 指令优先于后续指令
!重要
。既然你提到在萤火虫中被划掉的财产,我怀疑这是你的问题。
It becomes a mess after a while, but you can give CSS directives precedence over subsequent directives using
!important
.Since you mention the property being crossed off in firebug, I suspect this is your issue.