Created
July 10, 2013 12:04
-
-
Save croxton/5965737 to your computer and use it in GitHub Desktop.
jquery offset() problem
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
$('.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