我有一個使用實現幻燈片骨幹視圖。如何在Backbone.js視圖中觸發/綁定自定義事件?
iScroll發佈一個onScrollEnd
事件,但我似乎無法綁定/訂閱它的視圖中:
App.Views.Scroller = Backbone.View.extend({
events: {
'onScrollEnd' : 'scrollEnd'
},
initialize: function(){
var self = this;
this.scroller = new iScroll('content-scroller', {
onScrollEnd: function() {
self.trigger('onScrollEnd');
}
});
},
scrollEnd: function(e){
// never called :(
console.log(e);
}
});
我也試圖擴大與Backbone.Events – meleyal 2011-03-21 15:55:02