开发者

How to execute a function on every pixel move using jQuery's scroll() event

I've got a situation where I need to execute a simple function when the user scrolls the page. The problem is that jQuery's scroll method only fires intermittently (by design obviously), but I need a way of having it fire on every pixel move...

I have put together a js fiddle demonstrating what I mean...

http://jsfiddle.net/nGtSV/1/

What I'm trying to do is have the console.log in my fiddle fire 100 times if the user scrolls down/up 100 pixels开发者_Python百科 (once for each pixel). Is this possible?


In my opinion, it is not possible that jquery fire the event in each "pixel move".
But you can iterate your operation for each pixel by saving previous position:

http://jsfiddle.net/Fn3nt/


Use:

http://jsfiddle.net/nGtSV/5/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜