If you're looking to execute javascript code whenever someone finishes (or stops temporary) scrolling, moving the mouse, or resizing the page, you may find the following code segment useful.
var onFooEndFunc = function() {
var delay = 50; // Vary for effect
var executionTimer;
return function() {
if (!!executionTimer) {
clearTimeout(executionTimer);
}
executionTimer = setTimeout(function() {
// YOUR CODE HERE
}, delay);
};
}();
Simulated onScrollEnd:
Executed 0 times.
Simulated onMouseMoveEnd:
Executed 0 times.
Simulated onResizeEnd:
Executed 0 times.