Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(function($) {
$.fn.smoothScroll = function() {
return this.on('click', function() {
var hash = $(this).attr('href');
var dest = $(hash).offset();
$('html:not(:animated),body:not(:animated)').animate({scrollTop:, scrollLeft: dest.left}, 500, function() {
window.location.hash = hash;
return false;
$(function() {
Copy link

mxlje commented Dec 10, 2012

This is great, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment