How to use the ember-in-viewport/utils/is-in-viewport function in ember-in-viewport

To help you get started, we’ve selected a few ember-in-viewport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DockYard / ember-in-viewport / addon / -private / raf-admin.js View on Github external
const domScrollableArea = scrollableArea ? document.querySelector(scrollableArea) : undefined;

  const height = domScrollableArea
    ? domScrollableArea.offsetHeight + domScrollableArea.getBoundingClientRect().top
    : window.innerHeight;
  const width = scrollableArea
    ? domScrollableArea.offsetWidth + domScrollableArea.getBoundingClientRect().left
    : window.innerWidth;
  const boundingClientRect = element.getBoundingClientRect();

  if (boundingClientRect) {
    const viewportEntered = element.getAttribute('data-in-viewport-entered');

    triggerDidEnterViewport(
      element,
      isInViewport(
        boundingClientRect,
        height,
        width,
        viewportTolerance
      ),
      viewportSpy,
      enterCallback,
      exitCallback,
      viewportEntered
    );

    if (viewportSpy || viewportEntered !== 'true') {
      // recursive
      // add to pool of requestAnimationFrame listeners and executed on set schedule
      addRAF(
        startRAF.bind(
github DockYard / ember-in-viewport / addon / services / in-viewport.js View on Github external
isInViewport(...args) {
    return isInViewport(...args);
  }