Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // need to have this variable outside the scope of the handler defined below
- var timeoutId = null;
- // think of "connect" as pseudocode for whatever you use to connect handlers
- connect(widget, "onscroll", function() {
- // ...scrolling...
- if(timeoutId != null) clearTimeout(timeoutId);
- timeoutId = setTimeout(function() {
- // *probably* done scrolling, it has been
- // 1 second since the last scroll...
- // run your code to render current position here
- }, 1000);
- });
Add Comment
Please, Sign In to add comment