intersection in ionic josh morony code example
Example: intersection in ionic josh morony
// Create the observer
this.observer = new IntersectionObserver((entries) => {
entries.forEach((entry: any) => {
if(entry.isIntersecting){
// do something if intersecting
} else {
// do something if not intersecting
}
})
});
// Use the observer on specific elements
this.items.forEach(item => {
this.observer.observe(item.nativeElement);
});