Last active
August 29, 2015 14:06
-
-
Save joshuarule/6b6b4061bab1a191c60a to your computer and use it in GitHub Desktop.
scollto 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
// scrollto | |
// | |
// $fix 84 is equal to height of header | |
$.fn.scrollView = function () { | |
return this.each(function () { | |
$('html, body').animate({ | |
scrollTop: $(this).offset().top - 84 | |
}, 1000); | |
}); | |
} | |
$('.button').click(function(e){ | |
e.preventDefault(); | |
$('#div').scrollView(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment