As someone who is just starting out with javascript and Backbone.js, I am trying to figure out how to bind a custom listener to a Backbone view when it is initialized. For example, I want to achieve the following:
var CampaignListView = Backbone.View.extend({
initialize: function(){
this.on("customFunc")
},
customFunc: function() {
if (this.$el.scrollTop() == 500 ) {
console.log("this has occurred, time to do stuff")
}
}
)}
I'm looking for a way to trigger some code every time a user reaches a specific scroll position.
Any help would be greatly appreciated. Thank you!