dist/index.js
function isElementInViewport(el) {
    var eap;
    var rect = el.getBoundingClientRect();
    var docEl = document.documentElement;
    var vWidth = window.innerWidth || docEl.clientWidth;
    var vHeight = window.innerHeight || docEl.clientHeight;
    var efp = function (x, y) { return document.elementFromPoint(x, y); };
    var contains = el.contains ? (function (node) { return el.contains(node); }) : (function (node) { return el.compareDocumentPosition(node) == 0x10; });
    // Return false if it's not in the viewport
    if (rect.right < 0 || rect.bottom < 0
        || rect.left > vWidth || rect.top > vHeight)
        return false;
    // Return true if any of its four corners are visible
    return ((eap = efp(rect.left, rect.top)) == el || contains(eap)
        || (eap = efp(rect.right, rect.top)) == el || contains(eap)
        || (eap = efp(rect.right, rect.bottom)) == el || contains(eap)
        || (eap = efp(rect.left, rect.bottom)) == el || contains(eap));
}
function isElementInViewport(el) {
    var eap;
    var rect = el.getBoundingClientRect();
    var docEl = document.documentElement;
    var vWidth = window.innerWidth || docEl.clientWidth;
    var vHeight = window.innerHeight || docEl.clientHeight;
    var efp = function (x, y) { return document.elementFromPoint(x, y); };
    var contains = el.contains ? (function (node) { return el.contains(node); }) : (function (node) { return el.compareDocumentPosition(node) == 0x10; });
    // Return false if it's not in the viewport
    if (rect.right < 0 || rect.bottom < 0
        || rect.left > vWidth || rect.top > vHeight)
        return false;
    // Return true if any of its four corners are visible
    return ((eap = efp(rect.left, rect.top)) == el || contains(eap)
        || (eap = efp(rect.right, rect.top)) == el || contains(eap)
        || (eap = efp(rect.right, rect.bottom)) == el || contains(eap)
        || (eap = efp(rect.left, rect.bottom)) == el || contains(eap));
}
function isElementInViewport ( el ) { var eap ; var rect = el . getBoundingClientRect ( ) ; var docEl = document . documentElement ; var vWidth = window . innerWidth || docEl . clientWidth ; var vHeight = window . innerHeight || docEl . clientHeight ; var efp = function ( x , y ) { return document . elementFromPoint ( x , y ) ; } ; var contains = el . contains ? ( function ( node ) { return el . contains ( node ) ; } ) : ( function ( node ) { return el . compareDocumentPosition ( node ) == 0x10 ; } ) ; // Return false if it's not in the viewport if ( rect . right < 0 || rect . bottom < 0 || rect . left > vWidth || rect . top > vHeight ) return false ; // Return true if any of its four corners are visible return ( ( eap = efp ( rect . left , rect . top ) ) == el || contains ( eap ) || ( eap = efp ( rect . right , rect . top ) ) == el || contains ( eap ) || ( eap = efp ( rect . right , rect . bottom ) ) == el || contains ( eap ) || ( eap = efp ( rect . left , rect . bottom ) ) == el || contains ( eap ) ) ; }
Checks if an element is in the viewport
Checks if an element is in the viewport