Skip to content

Instantly share code, notes, and snippets.

@input
Created February 13, 2012 19:25
Show Gist options
  • Save input/1819345 to your computer and use it in GitHub Desktop.
Save input/1819345 to your computer and use it in GitHub Desktop.
Drupal 7 scrollTop Link
<a href="#" id="to-top" title="Back to top">To top</a>
Drupal.behaviors.totop = {
attach: function (context, settings) {
$('#to-top:not(.totop-processed)', context).addClass('totop-processed').each(function() {
$(this).click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
})
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment