Skip to content

Instantly share code, notes, and snippets.

@victorstanciu
Created October 19, 2012 12:54
Show Gist options
  • Save victorstanciu/3918100 to your computer and use it in GitHub Desktop.
Save victorstanciu/3918100 to your computer and use it in GitHub Desktop.
, process: function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
, maxScroll = scrollHeight - this.$scrollElement.height()
, offsets = this.offsets
, targets = this.targets
, activeTarget = this.activeTarget
, i
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets.last()[0])
&& this.activate ( i )
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
&& this.activate( targets[i] )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment