-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Allowing offset to defined as a function #20
Comments
Will check this out asap. |
One question, are you using "vainilla" scrollTo or serialScroll/localScroll on top? |
@flesler dynamic offset would be very useful for responsive layouts, for example in In this case it would be great if we could do: $('.navbar').localScroll({
duration: 800,
offset: {
top: function(){ return ($('.navbar').css('position') == 'static') ? 0 : -47 }
}
}); |
For future reference:
$('.navbar').localScroll({
duration: 800,
onBefore: function(){
this.offset = {
top: ($('.navbar').css('position') == 'static') ? 0 : -47
};
}
}); |
I think that's good enough. That's the reason I passed the settings to the On Tue, Mar 26, 2013 at 9:35 AM, loostro notifications@github.com wrote:
Ariel Flesler |
@flesler i think |
@flesler by the way, thank you for creating and shareing these great plugins 👍 |
I have a horizontal list of items in which I need to center the current item. The container that holds the list of items can be easily resized by the user. Therefore, I need the offset setting to be dynamic instead of static.
For this reason, I made the following changes in jquery.scrollTo.js:
At line https://github.com/flesler/jquery.scrollTo/blob/master/jquery.scrollTo.js#L193, I added a function to return the offset value
I removed line https://github.com/flesler/jquery.scrollTo/blob/master/jquery.scrollTo.js#L111
I changed line https://github.com/flesler/jquery.scrollTo/blob/master/jquery.scrollTo.js#L157 to
Best regards
The text was updated successfully, but these errors were encountered: