function isElementInViewport (el) {
    var rect = el.getBoundingClientRect();

    return (
        rect.top >= 0 &&
        rect.left >= 0 &&
        rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */
        rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */
    );
}
/**
 * Tests if the given element is visible inside the current viewport.
 * 
 * @param el Element to test.
 * 
 * @returns true if a part of the element is indeed visible.
 */
Tests if the given element is visible inside the current viewport.

@param el Element to test.

@returns true if a part of the element is indeed visible.
Tests if the given element is visible inside the current viewport . @param el Element to test . @returns true if a part of the element is indeed visible .
function isElementInViewport (el) {
    var rect = el.getBoundingClientRect();
    return (
        rect.top >= 0 &&
        rect.left >= 0 &&
        rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && 
        rect.right <= (window.innerWidth || document.documentElement.clientWidth) 
    );
}
function isElementInViewport ( el ) { var rect = el . getBoundingClientRect ( ) ; return ( rect . top >= 0 && rect . left >= 0 && rect . bottom <= ( window . innerHeight || document . documentElement . clientHeight ) && rect . right <= ( window . innerWidth || document . documentElement . clientWidth ) ) ; }
Tests if the given element is visible inside the current viewport.
Tests if the given element is visible inside the current viewport .
/*or $(window).height() */ /*or $(window).width() */