Last active
January 28, 2016 11:28
-
-
Save dDondero/d93fb4d1d9626817fdd1 to your computer and use it in GitHub Desktop.
SImple enough. Using jQuery to smooth scroll to certain <div>
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
jQuery(function(){ | |
function scrollToAnchor(aid){ | |
var aTag = jQuery("a[name='"+ aid +"']"); | |
jQuery('html,body').animate({scrollTop: aTag.offset().top},'slow'); | |
} | |
jQuery("#menu-item-243").click(function() { // Item to click | |
scrollToAnchor('kontakt'); // Item to scroll to | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment