登陆页面延迟然后自动向下滚动
Landing page with delay then auto scrolls downwards
我是 jquery/javascript 的新手,遇到了一个问题。
我有一个显示大徽标的登录页面。
在自动滚动生效之前,我想要 3 秒 pause/delay。
我现在使用的代码是-
JS
$('html, body').animate({scrollTop: $('#hello').offset().top}, 4000);
HTML
<div class="fillwindow" style="background-image:url('#')">
<div class="landing__logo">
<img class="landing__logo-img" src="#">
</div>
</div>
<div class="fillwindow" id="hello" style="background-image:url('#')">
<div class="nav-header">
<a href="<?php home_url(); ?>portfolio" class="nav-btn js-navBtn">PORTFOLIO</a>
</div>
<a href="<?php home_url(); ?>portfolio"><div class="nav-hitstate"></div></a>
</div>
根据上面的评论:
$(document).ready(function() {
setTimeout(function() {
('html, body').animate({scrollTop: $('#hello').offset().top },4000);
}, 2000);})
非常感谢 - Sideroxylon 的帮助。他的建议正是我一直在寻找的正确答案。
$(document).ready(function() {
setTimeout(function() {
$('html, body').animate({
scrollTop: $('#hello').offset().top
},4000);
}, 2000);
});
我是 jquery/javascript 的新手,遇到了一个问题。
我有一个显示大徽标的登录页面。 在自动滚动生效之前,我想要 3 秒 pause/delay。
我现在使用的代码是-
JS
$('html, body').animate({scrollTop: $('#hello').offset().top}, 4000);
HTML
<div class="fillwindow" style="background-image:url('#')">
<div class="landing__logo">
<img class="landing__logo-img" src="#">
</div>
</div>
<div class="fillwindow" id="hello" style="background-image:url('#')">
<div class="nav-header">
<a href="<?php home_url(); ?>portfolio" class="nav-btn js-navBtn">PORTFOLIO</a>
</div>
<a href="<?php home_url(); ?>portfolio"><div class="nav-hitstate"></div></a>
</div>
根据上面的评论:
$(document).ready(function() {
setTimeout(function() {
('html, body').animate({scrollTop: $('#hello').offset().top },4000);
}, 2000);})
非常感谢 - Sideroxylon 的帮助。他的建议正是我一直在寻找的正确答案。
$(document).ready(function() {
setTimeout(function() {
$('html, body').animate({
scrollTop: $('#hello').offset().top
},4000);
}, 2000);
});