BackToTop is a plugin that adds a “Back to top” link automatically to your page.
Everything is created by the plugin. No HTML code required !!
You can easily find thousand plugins like that, but ours is more customizable than all others (go to the demonstration page to see it) !
The link is entirely skinnable with css. On the demonstration page, the link is full CSS3. But you can adapt it for IE (IE is bad, please delete it from your computer and smash your customer using it).
Optionally it can benefits from the jQuery Easing plugin in order to provide a different easing animation for the scrolling effect of the page.
Download: https://github.com/axpart/BackToTop
Demonstration:
Plugin homepage:
Implementation:
1. FIRST, INCLUDE THE CSS & JQUERY FILES
<!-- include CSS & JS files -->
<!-- CSS file -->
<link rel="stylesheet" type="text/css" href="backtotop.css" media="screen" />
<!-- jQuery files -->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery-ui.js"></script>
<script type="text/javascript" src="BackToTop.min.jquery.js"></script>
2. MAKE A SIMPLE BACKTOTOP PLUGIN CALL
<script type="text/javascript">
$(document).ready(function(){
// simple BackToTop plugin called
BackToTop();
// more complex BackToTop plugin called
BackToTop({
text : 'My awesome text',
autoShow : false,
timeEffect : 750
});
});
</script>
Options:
text | String | Default : ‘A Back to top’ – Text written into the link |
auto Show | Boolean | Default : true – Does the link appears during scrolling the page or is always displayed ? |
timeEffect | Integer | Default : 500 – Duration (in ms) of the scrolling effect, from the bottom to the top of the page |
effectScroll | String | Default : ‘linear – all jQueryU effects allowed |
appearMethod | String | Default : ‘slide’ – How does the link appear ? Can be set to ‘fade’, ‘slide’ or empty |
auto ShowOffset | Integer | Default : 0 – Controls how many pixels the user scrolls down before the autoShow BackToTop link shows up |
opacity | Float | Default : 1 – Opacity (0-1) of the BackToTop button |
top | Integer | Default : 10 – In pixel, position of the BackToTop link from the top of the document |
Screenshots: