3.0.1 • Published 3 years ago

ngx-intersect-observer v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Angular library that implements the Intersection Observer API

Description

You can asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport.With this, you can easily implement:

  • Lazy-loading of images or other content as a page is scrolled.

  • Implementing "infinite scrolling" web sites, when more and more content is loaded and rendered as you scroll, so that the user doesn't have to flip through pages.

  • Reporting of visibility of advertisements in order to calculate ad revenues.

  • Deciding whether or not to perform tasks or animation processes based on whether or not the user will see the result.

DEMO

@see DEMO HERE

Choose the version corresponding to your Angular version:

Angularngx-intersect-observer
121.x+
112.x+
103.x+
93.x+

Getting started

  npm install --save ngx-intersect-observer

Setup

import { NgxIntersectObserverModule } from 'ngx-intersect-observer';
@NgModule({
  ...
  imports: [
    ...
    NgxIntersectObserverModule
  ]
})
export class AppModule {}

Using the component

  <ngx-intersect-observer [actionOnIntersection]="actionOnIntersection" [intersectionObserverInit]="intersectionObserInit" [intersectionCondition]="intersectionCondition"></ngx-intersect-observer>
@InputTypeDefault valueDescription
actionOnIntersectionfunctionvoidfunction to be called when target element is visible and intersection conditions are met
intersectionConditionbooleantrueExtra condition(s) to be met for actionOnIntersection to be called
intersectionObserverInitIntersectionObserverInit{threshold: 0.5}Properties

Issues and Pull Requests

Please file issues and open pull requests here. Thank you.

Licence

MIT

3.0.1

3 years ago

2.0.2

3 years ago

1.0.2

3 years ago

3.0.0

3 years ago

2.0.1

3 years ago

1.0.1

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago

0.0.1

3 years ago