Skip to content

Instantly share code, notes, and snippets.

@amboy00
Created December 6, 2012 14:55
Show Gist options
  • Save amboy00/4225004 to your computer and use it in GitHub Desktop.
Save amboy00/4225004 to your computer and use it in GitHub Desktop.
QUickly scroll to a div
$(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