I saw the Capture scroll event on div ticket, but the solution didn't necessarily work for me.
I have a JSFiddle that renders a Collection via a CompositeView, but can not get the scroll event to fire (building an infinite scroll): /.
How can I get scroll
to fire correctly?
I saw the Capture scroll event on div ticket, but the solution didn't necessarily work for me.
I have a JSFiddle that renders a Collection via a CompositeView, but can not get the scroll event to fire (building an infinite scroll): http://jsfiddle/franklovecchio/FkNwG/300/.
How can I get scroll
to fire correctly?
1 Answer
Reset to default 11 +50First scroll event only works for element that have overflow: scroll/auto. In your case it is the #region-content and not the #container.
But fixing the selector for events will not work, because Backbone uses jquery .delegate() to attach it's events. But delegate fails to trigger for scroll events.
I am afraid you will have to attach the event manually, after rendering the dom with
$("#region-content").scroll () ->
console.log "ok"
You can use live() to attach the events.
Alternatively, you can make #content scrollable and scroll that. This will work, as Backbone will not be use delegate, but it will bind the event directly to the #content node.