如何解开再绑定?

时间:2013-12-10 12:55:07

标签: javascript jquery

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

    },
   function(e) {  
   $(this).unbind('mouseenter');
});

我需要对图像设置效果。但我需要这种效果才能立刻起作用。但是我需要在mouseout上再次绑定。但它不起作用。

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

我该怎么做?

2 个答案:

答案 0 :(得分:0)

尝试

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

答案 1 :(得分:0)

你应该试试这个,

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

悬停基本上是一个伪事件,映射到 mouseenter mouseleave

相关问题