Skip to content

jQuery: Detect if Browser Scrollable

to detect when browser is scrollable, use below jQuery script:

 

if (jQuery(document).height() > jQuery(window).height()) {

//alert(‘scroll bar exist’);
}else
{
//alert(‘scroll bar Not exist’);
}
/* after page loaded */
jQuery(window).scroll(function(e) {
//alert(‘scrollable’);

});
/* after page resized or on window resize event*/
jQuery(window).resize(function(e) {
if (jQuery(document).height() > jQuery(window).height()) {

//alert(‘scroll bar exist’);
}else
{
//alert(‘scroll bar Not exist’);
}
});

 

Share

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.