Followers

Wednesday, 11 December 2013

Back to top button/link

Back to top button/link

A handy back to top button/link using jQuery with scroll to plugin. I like the scroll to top effect, you can test it by pressing the button below this page. You'll know what I meant : ) Get jQuery scrollTo plugin         http://plugins.jquery.com/project/ScrollTo
  1. $('#top').click(function() {
  2. $(document).scrollTo(0,500);
  3. }
  1. <a href="http://www.queness.com" rel="external">Queness in new window</a>
  2. <ul>
  3.     <li><a href="home">home</a></li>
  4.     <li><a href="home">about</a></li>
  5.     <li><a href="home">contact</a></li>
  6. </ul>
  7. <link rel="stylesheet" href="default.css" type="text/css">
  8. ......
  9. <a href="#" class="cssSwitcher" rel="default.css">Default Theme</a>
  10. <a href="#" class="cssSwitcher" rel="red.css">Red Theme</a>
  11. <a href="#" class="cssSwitcher" rel="blue.css">Blue Theme</a>
  12. <p></p>
  13. <a href="#" id="close"></a>
  14. <script type="text/javascript" src="js/jquery.scrollTo-min.js"></script>
  15. ......
  16. <a id="top" style="cursor:hand;cursor:pointer">
  17. Back to top
  18. <div class="col" style="border:1px solid">Column One<br/>
  19. With Two Line<br/>
  20. And the height is different<br/><br/>
  21. </div>
  22. <div class="col" style="border:1px solid">Column Two<br/><br/></div>
  23. <a class="increaseFont">+</a> |
  24. <a class="decreaseFont">-</a> |
  25. <a class="resetFont">=</a>
  26. <span>Font size can be changed in this section</span>
  27. <div class="section1">This won't be affected</div>
  28. <div class="section2">This one is adjustable too!</div>

No comments:

Post a Comment