Created
June 13, 2012 00:55
-
-
Save KarbonDallas/2921105 to your computer and use it in GitHub Desktop.
animated scroll...
This file contains hidden or 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
var easyScroll = function(selector, cb) { | |
var offset = $(selector).offset().top; | |
$('html, body').stop(true).animate({ scrollTop : ( (offset - 75 ) < 0 ? 0 : (offset - 75) ) }, { | |
duration : 300 | |
}, function(){ | |
if((cb) && (typeof cb == "function")) { | |
cb(); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
75 is good for my styles, adjust it accordingly for fixed navbars, etc.