删除/添加悬停后切换Jquery [英] Remove/Add hover after toggle Jquery

查看:146
本文介绍了删除/添加悬停后切换Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个css:

.disable {
          properties
          }

.comment_action:hover {
                       properties
                       }

jQuery:

//comment button index disable
$("#mydiv").toggle(function() {
 $(this).find(".comment_action").addClass('disable');   
},
function(){
 $(this).find(".comment_action").removeClass('disable');
});

我的问题是,当我做点击 .comment_action:hover不会消失或已删除。我希望如果我点击类 .comment_action:hover dissapear ,如果我再次点击 .comment_action:hover。

The problem for me is that when I doing click the .comment_action:hover is not disappear or removed. I want that If I doing click on the class .comment_action:hover dissapear and if I doing click again the .comment_action:hover appear.

推荐答案

您需要向中要覆写的属性添加!important >:hover psuedo-selector ...

You would need an !important added to properties you want to override in the :hover psuedo-selector...

因为:hover 即使 .disabled 被应用。

此外,你的javascript应该调用find与

Also your javascript should be calling find with .comment_action instead of comment_action

查看工作示例: http://jsfiddle.net/TN4rh/11/

这篇关于删除/添加悬停后切换Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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