Template:Team:KIT-Kyoto/Scroll
From 2014.igem.org
(Difference between revisions)
Line 9: | Line 9: | ||
$('html,body').animate({ scrollTop: p }, speed, 'swing'); | $('html,body').animate({ scrollTop: p }, speed, 'swing'); | ||
return false; | return false; | ||
- | }); | + | }); |
- | + | $(function() { | |
- | + | var topBtn = $('#page-top'); | |
- | + | topBtn.hide(); | |
- | + | $(window).scroll(function () { | |
- | + | if ($(this).scrollTop() > 150) {topBtn.fadeIn();} | |
- | + | else {topBtn.fadeOut();} | |
- | + | }); | |
- | + | topBtn.click(function () { | |
+ | $('body,html').animate({scrollTop: 0 }, 500); | ||
+ | return false; | ||
+ | }); | ||
}); | }); | ||
</script> | </script> |
Revision as of 20:10, 17 August 2014