Scroll to top link using JQuery | Back to Top link using JQuery (slow motion)

This is also one of magic of Jquery. If you run below example u will know how to scroll to top from botton of the page. I have implemented this feature for my blog. Please go botton of the page and click on image u will come top with slow motion.  This may be a JQuery Interview Question

If you have any queries please discuss with me in comments.

<html>
<head>
    <title></title>

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            $('a[href=#top]').click(function() {
                $('html, body').animate({ scrollTop: 0 }, 'slow');
                return false;
            });
        });
    </script>

</head>
<body>
<div id="top"></div>this is sample example for going to top from botton of blog


<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />v

<a href="#top" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtGUMkFRX02rfpiKH44ZRcdDNGLnvwS6GCaqu5Ie2y_j6INKcLiMCmVb3jNsVBDcSx59zNZfU-fVxKmLckkHwzt-YsPNV4LaDoXWj0LIIepsXgmIpaM_MmlSxicx1u_HYkdcK7Geh7hr55/s1600/go_top+.png" /></a>


</body>
</html>

Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar