如何解绑然后再次绑定

How unbind then bind again?

本文关键字:绑定 然后 何解绑      更新时间:2024-06-10
 $('.imgc').hover(
    function(e) {                              
         $(this).effect("bounce", { times:5 }, "slow"); 
    },
   function(e) {  
   $(this).unbind('mouseenter');
});

我需要在图像上设置效果。但我只需要这种效果一次起作用。但是我需要在鼠标退出时再次绑定。但它不起作用。

('.imgc').bind('mouseenter', e); 

我该怎么做?

尝试喜欢

$('.imgc').on('hover', function(e) {                              
         $(this).one(function () {
               $(this).effect("bounce", { times:5 }, "slow"); 
         });
        $(this).off('mouseenter');
    },
   function(e) {  
        $(this).on('mouseenter');
});

你应该试试这个,

$(".imgc").on({
   mouseenter:function(){
      $(this).effect("bounce", { times:5 }, "slow"); 
   },
   mouseleave:function(){
   }
});

悬停基本上是一个伪事件,它映射到 mouseentermouseleave