Joined October 2013
·

David

United States
·
·

Posted to Do you even code? [JavaScript Arrays] over 1 year ago

Well done. But ya, that's in just about every js library. Although handy if working with vanilla javascript.

// Seriously?

var TO = false;
var scroll_static = true;

$(window).scroll(function(){

if( scroll_static ){
    console.log('start scrolling');
    scroll_static = false;
}

if(TO !== false){ clearTimeout(TO); }           
TO = setTimeout(myfunction, 200); 

});

function myfunction(){

scroll_static = true;
console.log('stopped scrolling');

}

</code></pre>

200 is trigger offset time.

Achievements
1 Karma
0 Total ProTip Views