Simple Back To Top Link

File Size: 33.3 KB
Views Total: 8666
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Simple Back To Top Link

A simple script using jQuery library to create an animated "Back to Top" or "scroll to Top" link on your page. 

How to Use:

1. Include jQuery Library in your page:

<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>

2. Call the function:

<script type="text/javascript">
	$(document).ready(function(){
	$("#back-to-top").hide();
	$(function () {
		$(window).scroll(function(){
		if ($(window).scrollTop()>100){
		$("#back-to-top").fadeIn(1500);
		}
		else
		{
		$("#back-to-top").fadeOut(1500);
		}
		});
		//back to top
		$("#back-to-top").click(function(){
		$('body,html').animate({scrollTop:0},1000);
		return false;
		});
		});
		});
</script>

3. Markup:

<p id="back-to-top"><a href="#top"><span></span>Back To Top</a></p>

There you have it! Simple isn’t it?


This awesome jQuery plugin is developed by unknown. For more Advanced Usages, please check the demo page or visit the official website.