Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- smoothScroll(1000);
- function smoothScroll (duration) {
- $('a[href^="#"]').on('click', function(event) {
- var target = $( $(this).attr('href') );
- if( target.length ) {
- event.preventDefault();
- $('html,body').animate({
- scrollTop: target.offset().top
- }, duration);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement