I have a (fairly simple) problem, and I rack my brains over it.
The problem is quite simple - the event scrolldoes not fire (ever).
I am writing this angular project, so I tried the following:
angular.element($window).bind('scroll', ()=> {
console.log('scroll!');
if (!scope.scrollPosition) {
scope.scrollPosition = 0;
}
// Alerting for test cause wtf is going on
scope.boolChangeClass = this.pageYOffset > 600 ? alert(true) : alert(false);
scope.scrollPosition = this.pageYOffset;
scope.$apply();
}
);
but nothing happened. (suppose it is $windowintact and that I use webpack, etc.) This example works fine if I change the value scrollto click. weird.
So, I tried vanilla ~~!
window.addEventListener('scroll',function(){
console.log('test')
})
This attempt works on any site other than mine (be sure to recognize it as classic).
So - has anyone ever done this and knew what was going on?
I suggest that some other element consumes this event at an early stage, preventing it from bubbling. But this is just an assumption.
:)
=== ===
, monitorEvents(window) ( Chrome), , ..