Skip to content

Scrolled : a generic scroll event

Antoine Doury requested to merge scrolled into master

Scrolled : a really simple generic scroll event with the previous scroll value and the current scroll value. So at the end, one scroll event to used into multiple behaviors.

In your behavior js file :

function _handleScroll(event) {
  prevScrollPos = event.data.prev;
  lastScrollPos = event.data.last;
  console.log('Scrolling up or down ?')
  console.log(prevScrollPos);
  console.log(lastScrollPos);
}
document.addEventListener('scrolled', _handleScroll);

In your app.js file :

scrolled();
Edited by Antoine Doury

Merge request reports