How to add a simple Back to top button to your blog



A very simple way to add a back to top button to your blog



Paste this code to your gadget:
<!--linap's "Scroll to top" superblogger3.blogspot.gr-->
<style>#totop{display:none; position:fixed; right:3%;bottom:10px;} #totop:hover{cursor:pointer; background:none;} 
</style>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' type='text/javascript'>
</script>
<a id="totop"><img src="your image path 80x80 px" width="80px" height="80px" />
</a>
<script type='text/javascript'>
$(function(){ $(window).scroll(function(){ if($(this).scrollTop()>200){$("#totop").show()}
else{$("#totop").hide()}}); $("#totop").click(function(){$("body,html").animate({scrollTop:0},700);return false})}); 
</script>

Replace your image path 80x80 px  with your image path 



No comments:

Post a Comment