Created
April 15, 2014 00:07
-
-
Save MeoMix/10691531 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enables progressive rendering of children by keeping track of indices which are currently rendered. | |
minRenderedIndex: 0, | |
maxRenderedIndex: 25, | |
addItemView: function(item, ItemView, index) { | |
if (index >= this.minRenderedIndex || index < this.maxRenderedIndex) { | |
Backbone.Marionette.CompositeView.prototype.addItemView.apply(this, arguments); | |
} | |
}, | |
this.ui.itemContainer.scroll(function () { | |
var scrollTop = $(this).scrollTop(); | |
if (scrollTop >= 500) { | |
var nextBatch = self.collection.slice(self.maxRenderedIndex, self.maxRenderedIndex + 25); | |
console.log("nextBatch", nextBatch); | |
self.maxRenderedIndex += 25; | |
} | |
console.log("Scroll top:", $(this).scrollTop()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
more like this:
var scrollTop = $(this).scrollTop();