Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
79
rated 0 times [  86] [ 7]  / answers: 1 / hits: 17513  / 8 Years ago, tue, may 3, 2016, 12:00:00

I know there are some similar question concerning this problem, however I none of the solutions could help me.



I am using AngularJS and want to detect the scroll event. I tried plenty of versions on how to get the event, however at most it fires when first loaded then never again.



My last code I tried was the following:



$($window).on('scroll', alert('scrolled'));


But I also tried this:





and many more, but nothing works.



Can anyone tell my what I am doing wrong?



Update: I tried the directive stuff, this works perfectly fine with safari BUT however not with chrome. Whats going on?



Update2: It works with the chrome mobile view when using the shift key. Are there any restrictions on chrome to apple trackpad? WTF?


More From » jquery

 Answers
13

I would just use



$(window).scroll(function () { alert('scrolled') })


OR you could use



angular.element($window).bind(scroll, function(e) {
alert('scrolled')
})

[#62316] Saturday, April 30, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
conorm

Total Points: 339
Total Questions: 104
Total Answers: 104

Location: Angola
Member since Tue, May 5, 2020
4 Years ago
;