Created
June 16, 2015 08:35
-
-
Save aviogreen/638e08d8acfe37f95393 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
$('[data-animate-scroll]').each(function(index, el) { | |
$(this).on('click', function(event) { | |
var target = $( $(this).data('animate-scroll') ); | |
var speed = $(this).data('animate-scroll-speed') ? $(this).data('animate-scroll-speed') : 800; | |
$('html, body').animate({ | |
scrollTop: target.offset().top | |
}, speed); | |
return false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment