这是 JSFiddle:http: //jsfiddle.net/dAQrE/
在 javascript 部分的顶部,您将看到假设#proceed
在动画后向下滚动到 div 的代码:
第 1 行,第 2 行,第 3 行,第 4 行..
继续 div 页面应该滚动到:
<div id="proceed">
<div id="if_one"> <a href="http://websitelinkhere.com/1" class="button_primary agree">If Question 1 = Answer 1</a>
</div>
<div id="if_two"> <a href="http://websitelinkhere.com/2" class="button_primary agree">If Question 1 = Answer 2</a>
</div>
<div id="if_three"> <a href="http://websitelinkhere.com/3" class="button_primary agree">If Question 1 = Answer 3</a>
</div>
</div>
动画后应该滚动到#proceed
div 的 javascript:
// assign the correct target
var target = $('#proceed');
$('html, body').animate({
scrollTop: target.offset().top
}, 200);
// scroll!
$('html, body').animate({
scrollTop: target.offset().top
}, 200, function () {
target.css({
'border-color': 'red'
})
});
但是现在它在动画完成之前在#proceed div中显示内容并且它根本不会向下滚动..我该如何解决这个问题?