Created
March 16, 2015 13:55
-
-
Save keeprock/65f04b76c9f6e202bcfe to your computer and use it in GitHub Desktop.
Scroll viewport to calculated offset of a specified element
This file contains hidden or 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
| var body = $("html, body"); | |
| var element = $('SOME_SELECTOR'); | |
| body.animate({ | |
| scrollTop:element.offset().top | |
| }, 'swing', 2000); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment