我有这个脚本here它工作正常,但我需要使它在鼠标单击,而不是鼠标悬停工作。使用鼠标'点击'而不是'鼠标悬停'事件,jquery
我试过了,但失败了。它看起来很简单,但我无法弄清楚。谁能帮忙?
代码:下面
$(".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();
});
请问您可以添加不适用于该问题的代码吗? (点击标签下方的“编辑”按钮。)这意味着这个问题将来仍然有用。 – lonesomeday