Created
April 4, 2018 09:08
-
-
Save Nikschavan/a74c9eb2d281235547fba444eb5f1c9f to your computer and use it in GitHub Desktop.
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
jQuery(document).on('ready', function(event) { | |
// Scroll smoothly to anchor | |
jQuery('a[href^="#"]').on('click', function(event) { | |
var target = jQuery(this.getAttribute('href')); | |
if( target.length ) { | |
event.preventDefault(); | |
jQuery('html, body').stop().animate({ | |
scrollTop: target.offset().top | |
}, 1000); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a doc which explains how custom JS can be added to your site - https://wpastra.com/docs/add-custom-javascript-code-astra/