"mouseenter"및 "mouseleave"이벤트를 바인딩 해제하려는 요소를 클릭하면 제대로 작동하지만 다른 요소를 클릭하면 다시 바인드하고 싶습니다. -이 작동하지 않습니다.jQuery "bind"back to bind "no"
어떤 도움이 필요합니까?
<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>
많은 감사 :
여기에 코드입니다!
바인드에 함수를 연결해야합니다. bind ('mouseenter mouseleave', function() { $ (this) .toggleClass ('entered'); }); –
(a) 왜'bind' /'unbind'를 사용하고'on' /'off'하지 않습니까? (b) 이벤트 핸들러를 첨부하려면 하나를 지정해야합니다! –