code: function isInViewport(element) {
          var rect = element.getBoundingClientRect();
          var html = window.document.documentElement;
          return (
              rect.top >= 0 &&
              rect.left >= 0 &&
              rect.bottom <= (window.innerHeight || html.clientHeight) &&
              rect.right <= (window.innerWidth || html.clientWidth)
          );
      }
docs: Checks if the element is in Viewport in the client browser