isInViewport

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.is

Check if the passed HTMLElement is in the viewport or not

Params

  1. $elm*-HTMLElement

    The element to check if it is in viewport or not

Return

  1. -Boolean

    If the element is in the viewport or not

Example

import { isInViewport } from '@blackbyte/sugar/is'
if (isInViewport(myCoolHTMLElement) {
  // i'm in the viewport
}

Todo

  • testsnormal