Created
December 6, 2012 14:55
-
-
Save amboy00/4225004 to your computer and use it in GitHub Desktop.
QUickly scroll to a 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
$(document).ready(function() { | |
var scroll = function() { | |
$("html, body").scrollTop(Math.round($('#myDIv').parent('section').offset().top)); | |
console.log($('#myDIv').offset().top); | |
clearTimeout(t); | |
} | |
var t = setTimeout(scroll,20); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment