Template:Team:KIT-Kyoto/Scroll
From 2014.igem.org
(Difference between revisions)
(13 intermediate revisions not shown) | |||
Line 4: | Line 4: | ||
$(".btn").click(function () { | $(".btn").click(function () { | ||
var i = $(".btn").index(this) | var i = $(".btn").index(this) | ||
- | var p = $(". | + | var p = $(".scroll").eq(i).offset().top; |
- | p -= | + | p -= 70; |
- | $('html,body').animate({ scrollTop: p }, ' | + | $('html,body').animate({ scrollTop: p }, 500, 'swing'); |
return false; | return false; | ||
- | }); | + | }); |
+ | var top = $('#page-top'); | ||
+ | top.hide(); | ||
+ | $(window).scroll(function () { | ||
+ | if ($(this).scrollTop() > 150) {top.fadeIn();} | ||
+ | else {top.fadeOut();} | ||
+ | }); | ||
+ | top.click(function () { | ||
+ | $('body,html').animate({scrollTop: 0 }, 500, 'swing'); | ||
+ | return false; | ||
+ | }); | ||
+ | }); | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
</script> | </script> |
Latest revision as of 08:38, 15 September 2014