sroze / ngInfiniteScroll

Infinite Scrolling for AngularJS
http://sroze.github.com/ngInfiniteScroll/
MIT License
2.89k stars 723 forks source link

scrolling event handler never get triggered if the DOM structure is too deep #33

Closed LeoAJ closed 10 years ago

LeoAJ commented 10 years ago

Hi

I ran into an issue that the entire infinite scroll is not working, and I figured out the reason which is the scroll event handler never get executed. Because my content DOM is deep inside of the entire DOM structure, and scroll event is not bubbling up, thus the event handler never get triggered, Since the event handler is registered on $window object.

I suggest a solution which is created another attribute to specify the scrolling target used ID on the directive, and if it is defined registered the scroll event handler on that, if not use the $window.

Any suggestions ? Thanks! Leo

kristianmandrup commented 10 years ago

Sounds like a very sensible idea :) :+1:

pferrel commented 10 years ago

I made a couple improvements to the sample code that detects when there are no more results to fetch and so stops making calls and a couple other minor tweeks. Would you like it back?

LeoAJ commented 10 years ago

i overwrote my own version since we are approaching to the deadline i cannot wait...thanks anyway @pferrel !!

kristianmandrup commented 10 years ago

If you have a lot of stream handling and nested callbacks etc, try using BaconJS. It would simplify the logic and clean it up and make it much more extensible ;)

On Wed, Nov 6, 2013 at 7:43 PM, Leo Hsieh notifications@github.com wrote:

i overwrote my own version since we are approaching to the deadline i cannot wait...thanks anyway @pferrel https://github.com/pferrel !!

— Reply to this email directly or view it on GitHubhttps://github.com/BinaryMuse/ngInfiniteScroll/issues/33#issuecomment-27901164 .

LeoAJ commented 10 years ago

Thanks @kristianmandrup ! I will give it a try, appreciated.

kristianmandrup commented 10 years ago

You could also try https://github.com/Sage/streamlinejs/

He is the guy behind an awesome book series on REAL functional programming. A true master!

https://leanpub.com/javascript-allonge

You gotta check out this blog post ;)

http://bjouhier.wordpress.com/2011/01/09/asynchronous-javascript-the-tale-of-harry/

LeoAJ commented 10 years ago

Nice! Thanks again @kristianmandrup !

mattboehm commented 10 years ago

Duplicates #34 and a few other issues.

sroze commented 10 years ago

Duplicate of #7 .