How to trigger / bind custom events in Backbone.js views?

前端 未结 3 730
情深已故
情深已故 2021-01-31 16:30

I have a Backbone View that uses iScroll to implement a slideshow.

iScroll publishes an onScrollEnd event, but I cannot seem to bind/subscribe to it inside

3条回答
  •  再見小時候
    2021-01-31 16:37

    Your onScrollEnd event is bound to the view's top element; scrollEnd will be called when the view's HTML element received an onScrollEnd event.

    But you are triggering an onScrollend event on your View object, not the element.

    So you probably want to say $(self.el).trigger('onScrollEnd'); instead, or perhaps call the function directly: self.scrollEnd().

提交回复
热议问题