Return to Snippet

Revision: 56661
at April 8, 2012 01:29 by kyllle


Initial Code
//Hide/Show #toTop
  jQuery(window).scroll(function () {
    if (jQuery(this).scrollTop() != 0) {
      jQuery('#toTop').fadeIn();
    } else {
      jQuery('#toTop').fadeOut();
    }
  });
//Scroll to top
jQuery('#toTop').click(function () {
    jQuery('body,html').animate({
      scrollTop: 0
    }, 300);
  });

Initial URL

                                

Initial Description
If scrollTop isnt equal to 0 then show #toTop

Initial Title
Show scroll to top if top != 0

Initial Tags
jquery

Initial Language
jQuery