For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Friday, March 13, 2015

bottom to top scroll in html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#back-to-top {
     position: fixed;
     bottom: 30px;
     top: 350px;
}
#back-to-top img{
    cursor:pointer;
}
</style>
<script language="javascript" src="jquery-1.10.2.js" type="text/javascript"></script>
</head>
<body>
<h1>Back To Top</h1>
<p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p>
<p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p>
<p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p>
<p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p>
<p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p><p>fsdfsdfsdf</p>
<div style="height:1000px"></div>
<span id="back-to-top"><img id="bus" src='bus.gif'/></span>
</body>
<script type="text/javascript">
        $(document).ready(function () {
            $("#back-to-top").hide();
            $(window).scroll(function () {
                if ($(window).scrollTop() > 200) {
                    $('#back-to-top').fadeIn();
                } else {
                    $('#back-to-top').fadeOut();
                }
            });
              $('#back-to-top img').click(function () { 
               var body = $("body, html");
               body.animate({scrollTop :0}, '1500',function(){ });
            });
        });
    </script>
</html>
Share:

0 comments:

Post a Comment

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights   You have a website and want to test it'...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive