Skip to content

Instantly share code, notes, and snippets.

@croxton
Created July 10, 2013 12:04
Show Gist options
  • Save croxton/5965737 to your computer and use it in GitHub Desktop.
Save croxton/5965737 to your computer and use it in GitHub Desktop.
jquery offset() problem
$('.scroll').click(function() {
var $target = $(this.hash);
if ($target.length && $target.html()!=undefined) {
var targetOffset = $target.offset().top;
$('html, body').animate({scrollTop: targetOffset}, 600);
}
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment