Created
April 17, 2013 13:53
-
-
Save jswebschmiede/5404492 to your computer and use it in GitHub Desktop.
scroll to element with jQuery
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
function scrollToEle($ele) { | |
var x = $($ele).offset().top; | |
$('html,body').animate({scrollTop: x}, 500); | |
} | |
$(document).ready(function(){ | |
scrollToEle('#test-div'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment