Template:Team:KIT-Kyoto/Scroll
From 2014.igem.org
(Difference between revisions)
Line 3: | Line 3: | ||
$(function() { | $(function() { | ||
$(".btn").click(function () { | $(".btn").click(function () { | ||
- | |||
var i = $(".btn").index(this) | var i = $(".btn").index(this) | ||
var p = $(".sentence").eq(i).offset().top; | var p = $(".sentence").eq(i).offset().top; | ||
p -= 100; | p -= 100; | ||
- | $('html,body').animate({ scrollTop: p }, | + | $('html,body').animate({ scrollTop: p }, 500, 'swing'); |
return false; | return false; | ||
}); | }); | ||
Line 17: | Line 16: | ||
}); | }); | ||
topBtn.click(function () { | topBtn.click(function () { | ||
- | $('body,html').animate({scrollTop: 0 }, 500); | + | $('body,html').animate({scrollTop: 0 }, 500, 'swing'); |
return false; | return false; | ||
}); | }); |
Revision as of 20:18, 17 August 2014