jquery mousewheel plugin: how to fire only one function every scroll

99封情书 提交于 2019-12-04 12:55:15
BernardMarx

You could try playing with window.setTimeout. Maybe by pulling out your nested function and using something a proxy function with a timer. Example:

var timer; 

function proxyFunction(){
  clearTimeout(timer);
  timer = setTimeout("mouseWheelAction", 1);
}

This will not stop the event firing but it will stop your function from running everytime the event fires.

Sicck, got it. If you are running an animation inside just preface it with .stop() So it would read

$('#findme').stop().animate(...);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!