【发布时间】:2015-04-27 03:53:32
【问题描述】:
我有一个网页,我在折叠上方的圆圈中显示一个向下的箭头,表示下面有更多内容。单击此箭头时,我有 jQuery 来执行动画滚动到页面底部,然后 jQuery 向上滚动到所需的位置。当动画到达页面底部时,我想让 jQuery 立即开始向上滚动到所需的位置,而在页面底部没有短暂的暂停。我尝试在每个动画结束时使用和不使用函数选项使用 jQuery,当第一个动画到达页面底部时,我仍然注意到暂停。
示例页面位于: Click Here
我的示例代码是:
<script type="text/javascript">
$(document).ready(function (){
$("#arrow-circle").click(function (){
//$(this).animate(function(){
$('html, body').animate({
scrollTop: $("#footer-seamless-name").offset().top
}, 2500);
$('html, body').animate({
scrollTop: $("#arrow-circle").offset().top
}, 1000);
$('html, body').animate({
scrollTop: getFoldHeight()
}, 1000);
//});
});
});
</script>
<script type="text/javascript">
$(document).ready(function (){
$("#arrow-circle").click(function (){
//$(this).animate(function(){
$('html, body').animate({
scrollTop: $("#footer-seamless-name").offset().top
}, 2500, function() {
$('html, body').animate({
scrollTop: $("#arrow-circle").offset().top
}, 1000, function () {
$('html, body').animate({
scrollTop: getFoldHeight()
}, 1000);
//});
});
});
});
});
</script>
【问题讨论】:
-
可以在 Question 中包含
html,getFoldHeight()吗?
标签: jquery scroll jquery-animate