All I\'m trying to do is to call a function when a DIV
is scrolled.For simplicity sake Im not specifying anything else. Also I am only looking at DOM compliant brow
It happened because your div has height: 100%
or height: 100vh
.
In that case, the scroll event will disable automatically if you gave height:
Remove that div height, Remove any height on its parent, child. Basically, that particular div should scroll not its parent or child.
then this should work.
const AppWrapper = document.getElementById('app-content');
AppWrapper.removeEventListener('scroll', toggleVisibility);
toggleVisibility = () => {
console.log('Do your thg');
};