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 segment of code useful.
var onFooEndFunc = function() {
var delay = 50; /* milliseconds - vary as desired */
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.