On-scroll not firing on ion-content when overflow-scroll is true


#1

title says it all.

If it write

<ion-content overflow-scroll="false" on-scroll="onContentScroll()">

onContentScroll gets called. But when i set to,

<ion-content overflow-scroll="true" on-scroll="onContentScroll()">

Then onContentScroll is never called.

Any idea? If i need to listen for some custom events, thats okey. Just point point me in the direction.

PS: I need to use overflow-scroll bcz default ionic scroll is slow in android.


#2

It won’t fire because on-scroll relies on our js-scroller.

You would have to use something like this.

// grab elements as array, rather than as NodeList
var elements = document.querySelectorAll("...");
elements = Array.prototype.slice.call(elements);

// make each element do something on scroll
elements.forEach(function(element) {
  window.addEventListener("scroll", function(evt) {
    // not the most exciting thing, but a thing nonetheless
   console.log(element);
  });
});