0 points

javascript - Detect if a page has overflow


dashboard

Mon Jun 29 2020 11:44:27 GMT+0000 (UTC)

Posted by @peota #javascript

$(document).ready(function() {
    // Check if body height is higher than window height :)
    if ($("body").height() > $(window).height()) {
        alert("Vertical Scrollbar! D:");
    }

    // Check if body width is higher than window width :)
    if ($("body").width() > $(window).width()) {
        alert("Horizontal Scrollbar! D:<");
    }
});
content_copy Copy

https://stackoverflow.com/questions/2146874/detect-if-a-page-has-a-vertical-scrollbar