Tweakr
    Preparing search index...

    Function isInViewport

    • Checks if an element is fully within the viewport.

      Parameters

      • element: Element

        The DOM element to check.

      Returns boolean

      true if the element is completely visible in the viewport, false otherwise.

      const el = document.querySelector("#myElement");
      if (el && isInViewport(el)) {
      console.log("Element is visible in viewport");
      }

      1.1.0