Last active
August 29, 2015 14:08
-
-
Save adrianorsouza/e7ed1309489c914af1c0 to your computer and use it in GitHub Desktop.
jQuery scrollTo element effect
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
$("body,html").animate({ | |
scrollTop : ( | |
$('div.element:last').offset().top // get the offset of the last element to scrollTo | |
- $('header.navbar').outerHeight() // get the difference whether there is fixed header element | |
+ $('div.element:last').outerHeight() // get the element itself height to make scroolTo be exact under the fixed header | |
) | |
},1500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment