javascript - Detect if a page has overflow

PHOTO EMBED

Mon Jun 29 2020 11:44:27 GMT+0000 (Coordinated Universal Time)

Saved 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_copyCOPY

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