Last active
May 13, 2024 09:34
-
-
Save steveosoule/4455944 to your computer and use it in GitHub Desktop.
Simple Scroll To Anchor
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
// Found at: http://jsfiddle.net/BjpWB/4 | |
function scrollToAnchor(aid){ | |
var aTag = $("a[name='"+ aid +"']"); | |
$('html,body').animate({scrollTop: aTag.offset().top},'slow'); | |
} | |
scrollToAnchor('id3'); | |
function scrollTo($element){ | |
$('html,body').animate({scrollTop: $element.offset().top},'slow'); | |
} | |
scrollTo($('#something')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment