signalizejs/viewport

Retrieve element information relative to the current viewport.

Installation

Required import map dependencies:
const { isInViewport } = await signalize.resolve('viewport');

API

isInViewport

Retrieve information about an element’s position relative to the viewport.

import Signalize from 'signalizejs';
import widthPlugin from 'signalizejs/width';
import heightPlugin from 'signalizejs/height';
import offsetPlugin from 'signalizejs/offset';
import isInViewportPlugin from 'signalizejs/is-in-viewport';

const { isInViewport } = signalize;

const {
	top,
	bottom,
	whole
} = isInViewport(document.querySelector('#carousel'));