2016-07-16 21 views
0

我不知道我在做什麼,所以我想只是「複製我所看到的不知道我在做什麼」 ......如何實現jQuery的油門反跳上的addEventListener

<script> 

// This works: 

$window.scroll($.throttle(50, function(event) { 
    // stuff happens 
})); 

// These don't work 

target.addEventListener($.throttle(50,"mouseover", function(event) { 

}, false)); 

I also tried 

target.addEventListener.throttle("mouseover", function(event) { 
    // do stuff 
}, false), 50); 

</script> 

好像是一個集合TimeTimeout

有人可以幫忙。

回答

1
$('button').on('click', $.throttle(100,function() { 
    // ... 
})); 

$('button').click($.throttle(100,function() { 
    // ... 
}));