看看这个小提琴:JsFiddle
当 $(document) 准备好时,我正在调用事件来显示(显示、fadeIn、slideDown 等)并滚动到元素。
我将显示功能的计时器以毫秒为单位放置在 3 秒,滚动到 4 秒。您可以根据需要调整这些时间以显示您认为合适的隐藏元素。
CSS
#container{height:850px;background-color:red;width:300px;text-align:center; }
#bottomDiv{display:none;position:relative;top:400px;width:260px;height:200px; background-color:dodgerblue;margin:20px auto;border: 1px solid #000000;text-align:center;}
HTML
<div id="container" style="height:1500px;background-color:red;width:300px;">
<p>I'm opening a div and scrolling below</p>
<div id="bottomDiv" class="tempCss">Bottom Div</div>
</div>
脚本
$(document).ready(function(){
$("#bottomDiv").slideDown(3000);
$('html, body').animate({ scrollTop: $("#bottomDiv").offset().top }, 4000,function(){
});
});