当我单击一个元素时,我想取消绑定“mouseenter”和“mouseleave”事件,这可以正常工作,但是如果单击另一个元素,我想将它们重新绑定 - 这不起作用。
有什么帮助吗?
这是代码:
<script type="text/javascript">
$(document).ready(function(){
$("#shape1 img").click(function(){
$("#shape1 img,#shape2 img, #shape3 img, #shape4 img, #shape5 img").unbind('mouseenter mouseleave');
});
$("#close").click(function(){
$("#shape1 img,#shape2 img, #shape3 img, #shape4 img, #shape5 img").bind('mouseenter mouseleave');
});
});
</script>
非常感谢!