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="http://1.bp.blogspot.com/-IVi0tGshOjg/T82gX-mmdGI/AAAAAAAAALs/gAbNIGEsfFM/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