Posted By

sebikovacs on 10/25/10


Tagged

scroll


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

melik
kwameboame
Tyster
superman
dubogii


Scroll To Top plugin


 / Published in: jQuery
 

This is a plugin that scrolls the page up slowly and fades out the clicked link. It's a plugin but I can't find the author. If you know who wrote it please leave a url in the comment section and I'll update

  1. //scroll to top...................................
  2. $(function(){
  3. $.fn.scrollToTop=function(){
  4. $(this).hide().removeAttr("href");
  5. if($(window).scrollTop()!="0"){
  6. $(this).fadeIn("slow")
  7. }
  8. var scrollDiv=$(this);
  9. $(window).scroll(function(){
  10. if($(window).scrollTop()=="0"){
  11. $(scrollDiv).fadeOut("slow")
  12. }else{
  13. $(scrollDiv).fadeIn("slow")
  14. }
  15. });
  16. $(this).click(function(){
  17. $("html, body").animate({scrollTop:0},"slow")
  18. })
  19. }
  20. });
  21. $(function() {$("#toTop").scrollToTop();});

Report this snippet  

You need to login to post a comment.