Answers for "how to know that i am at the top of a viewport in javascript"

2

javascript in viewport

var isInViewport = function (elem) {
    var bounding = elem.getBoundingClientRect();
    return (
        bounding.top >= 0 &&
        bounding.left >= 0 &&
        bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
        bounding.right <= (window.innerWidth || document.documentElement.clientWidth)
    );
};
Posted by: Guest on April-30-2020

Code answers related to "how to know that i am at the top of a viewport in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language