Using jQuery or plain JavaScript I want to run a function on document ready
, if the page has a vertical scrollbar and the amount by which the page can be scrolled is 200px
or larger.
Basically, I want to modify the code below so that it runs on document ready
, not when the user actually scrolls.
$(document).ready(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 200) {
// do stuff
}
});
});