Created
March 24, 2015 08:12
-
-
Save ritz078/75c238ffa59244ae8e1a to your computer and use it in GitHub Desktop.
Scroll to div animation
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
$('li>a[href^="#"]').on('click',function (e) { | |
e.preventDefault(); | |
var target = this.hash; | |
var $target = $(target); | |
$('html, body').stop().animate({ | |
'scrollTop': $target.offset().top-60 | |
}, 200, 'swing', function () { | |
window.location.hash = target; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment