Created
December 4, 2011 00:02
-
-
Save ocean90/1428560 to your computer and use it in GitHub Desktop.
Click on the Admin Bar to scroll to top
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
<?php | |
function ds_admin_bar_scrolltop() { | |
if ( ! is_admin_bar_showing() ) | |
return; | |
?> | |
<script> | |
( function( $ ) { | |
$( '#wpadminbar' ).click( function() { | |
$( 'html, body' ).animate( { scrollTop: 0 }, 100 ); | |
} ); | |
$( '#wpadminbar li' ).click( function( e ) { | |
e.stopPropagation(); | |
} ); | |
} )( jQuery ); | |
</script> | |
<?php | |
} | |
add_action( 'admin_print_footer_scripts', 'ds_admin_bar_scrolltop' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment