Javascript 使用settimeout滚动页面-我需要在代码中添加settimeout或延迟

Javascript 使用settimeout滚动页面-我需要在代码中添加settimeout或延迟,javascript,function,scroll,settimeout,scrolltop,Javascript,Function,Scroll,Settimeout,Scrolltop,我需要插入一个settimeout,让用户有时间查看主页。然后滚动到web的内容以自动div。除非用户已经有了滚动条 $(document).ready(function (){ $(window).ready(function (){ $('html, body').animate({ scrollTop: $("#hola").offset().top }, 5000);

我需要插入一个settimeout,让用户有时间查看主页。然后滚动到web的内容以自动div。除非用户已经有了滚动条

     $(document).ready(function (){
        $(window).ready(function (){
            $('html, body').animate({
                scrollTop: $("#hola").offset().top
            }, 5000);
        });
        $("html, body").bind("scroll mousedown DOMMouseScroll mousewheel keyup", function(){
$('html, body').stop();

保存用户鼠标位置,如果鼠标位置更改,则每3秒使用setInterval检查一次-如果更改了,则只保存新的鼠标位置,否则只需滚动。我希望你已经有你的滚动逻辑了

请解释为什么你不能和你想做什么…对不起!我需要插入一个settimeout,让用户有时间查看主页。然后自动滚动网页内容。除非用户已经有了scrolleri,否则我需要插入一个settimeout,让用户有时间查看主页。然后自动滚动网页内容。除非用户已经有了滚动条。如果用户不使用鼠标移动,滚动条不会滚动3秒,如果用户一直使用鼠标,滚动条将永久保留。