【发布时间】:2012-10-16 05:43:16
【问题描述】:
我有这个脚本 here 可以正常工作,但我需要让它在鼠标单击而不是鼠标悬停时工作。
我尝试过,但失败了。它看起来很简单,但我无法弄清楚。有人可以帮忙吗?
代码是:
$(".cat").hover(function(){
$(this).parent().parent().find(".sub_menu").hide();
},
function() {
$(this).parent().parent().find(".sub_menu").show();
});`
下面的代码在 ie 中工作,而不是在 firefox 中。
$(".cat").on('click', function(){
$(this).parent().parent().find(".sub_menu").toggle();
});
【问题讨论】:
-
能否请您将不起作用的代码添加到问题中? (点击标签下方的“编辑”按钮。)这意味着该问题将来仍然有用。
标签: jquery mousehover onmouseclick