Created
November 5, 2015 21:57
-
-
Save smeric/f182b22db0de5e4671b5 to your computer and use it in GitHub Desktop.
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
/** | |
* Smooth scroll : | |
* <a href="#top" class="go-top">Top</a> | |
* $( '.go-top' ).click( function( e ){ e.preventDefault(); $( this ).autoscroll( $( this ).attr( 'href' ) ); }); | |
**/ | |
( function( $ ) { | |
$.fn.autoscroll = function( selector ) { | |
$( 'html,body' ).animate({ | |
scrollTop: $( selector ).offset().top | |
}, 200); | |
}; | |
})( jQuery ); | |
/*! Smooth scroll packed */ | |
!function(o){o.fn.autoscroll=function(s){o("html,body").animate({scrollTop:o(s).offset().top},200)}}(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment