src/core/element.js
/**
   * Checks if the current element is visible in viewport
   * @returns {boolean}
   */
Checks if the current element is visible in viewport
@returns {boolean}
Checks if the current element is visible in viewport @returns { boolean }
isInView() {
    let top = this.node.offsetTop;
    let left = this.node.offsetLeft;
    const width = this.node.offsetWidth;
    const height = this.node.offsetHeight;
    let el = this.node;
    while (el.offsetParent) {
      el = el.offsetParent;
      top += el.offsetTop;
      left += el.offsetLeft;
    }
    return (
      top >= this.window.pageYOffset &&
      left >= this.window.pageXOffset &&
      (top + height) <= (this.window.pageYOffset + this.window.innerHeight) &&
      (left + width) <= (this.window.pageXOffset + this.window.innerWidth)
    );
  }
isInView ( ) { let top = this . node . offsetTop ; let left = this . node . offsetLeft ; const width = this . node . offsetWidth ; const height = this . node . offsetHeight ; let el = this . node ; while ( el . offsetParent ) { el = el . offsetParent ; top += el . offsetTop ; left += el . offsetLeft ; } return ( top >= this . window . pageYOffset && left >= this . window . pageXOffset && ( top + height ) <= ( this . window . pageYOffset + this . window . innerHeight ) && ( left + width ) <= ( this . window . pageXOffset + this . window . innerWidth ) ) ; }
Checks if the current element is visible in viewport
 @returns {boolean}
Checks if the current element is visible in viewport @returns { boolean }