function elementInView( elem, strict ) {
  var windowHeight = window.innerHeight;
  var windowTop = window.pageYOffset;
  var windowBottom = windowTop + windowHeight;
  var elementHeight = elem.offsetHeight;
  var elementTop = elem.getBoundingClientRect().top + windowTop;
  var elementBottom = elementTop + elementHeight;

  if ( strict ) {
    return elementTop >= windowTop && elementBottom <= windowBottom;
  }
  return elementBottom >= windowTop && elementTop <= windowBottom;
}
/**
 * @param {HTMLNode} elem The DOM element to check for
 * @param {Boolean} strict Tests whether whole element is
 * onscreen rather than just a part.
 * @returns {Boolean} Whether the element is in the viewport.
 */
@param {HTMLNode} elem The DOM element to check for
@param {Boolean} strict Tests whether whole element is
onscreen rather than just a part.
@returns {Boolean} Whether the element is in the viewport.
@param { HTMLNode } elem The DOM element to check for @param { Boolean } strict Tests whether whole element is onscreen rather than just a part . @returns { Boolean } Whether the element is in the viewport .
function elementInView( elem, strict ) {
  var windowHeight = window.innerHeight;
  var windowTop = window.pageYOffset;
  var windowBottom = windowTop + windowHeight;
  var elementHeight = elem.offsetHeight;
  var elementTop = elem.getBoundingClientRect().top + windowTop;
  var elementBottom = elementTop + elementHeight;
  if ( strict ) {
    return elementTop >= windowTop && elementBottom <= windowBottom;
  }
  return elementBottom >= windowTop && elementTop <= windowBottom;
}
function elementInView ( elem , strict ) { var windowHeight = window . innerHeight ; var windowTop = window . pageYOffset ; var windowBottom = windowTop + windowHeight ; var elementHeight = elem . offsetHeight ; var elementTop = elem . getBoundingClientRect ( ) . top + windowTop ; var elementBottom = elementTop + elementHeight ; if ( strict ) { return elementTop >= windowTop && elementBottom <= windowBottom ; } return elementBottom >= windowTop && elementTop <= windowBottom ; }
@param {HTMLNode} elem The DOM element to check for
 @param {Boolean} strict Tests whether whole element is
 onscreen rather than just a part.
@param { HTMLNode } elem The DOM element to check for @param { Boolean } strict Tests whether whole element is onscreen rather than just a part .