Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified topOffset option and added $.scrollIt.destroy() function to remove event handlers #35

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mphasize
Copy link

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!

…that object’s properties so we can adjust the offsetTop nicely in responsive layouts. Yeah! :-)
…t.listeners object to expose event handlers.
Using an object for topOffset we can change that value during the page views lifecycle, which makes responsive webdesigns a little easier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant