scrollIt.js
scrollIt.js copied to clipboard
Modified topOffset option and added $.scrollIt.destroy() function to remove event handlers
Breaking Change: Modified the topOffset option to accept an object with { val : 0 }. The way Javascript works, this enables us to keep a variable outside of scrollIt like this:
var topOffset = {
val: -30
}
$.scrollIt({
topOffset : topOffset
});
topOffset.val = -90; // scrollIt will now use updated topOffset
This modification is pretty useful, when you want to create responsive layouts in combination with scrollIt.
Second change: I added a function to remove the scrollIt event handlers. This is quite useful when building a single page app or using frameworks like Ember, so that you can cleanly remove scrollIt and re-initialize it when you move around the page.
Use $.scrollIt.destroy()
Cheers!