滚动页面与settimeout -我需要添加一个settimeout或延迟到我的代码

scroll page with settimeout - i need add a settimeout or delay to my code

本文关键字:settimeout 一个 延迟 我的 迟到 代码 添加 滚动      更新时间:2023-09-26

我需要插入一个settimeout来给用户时间来查看"home"。然后滚动(scrollTo)网页的内容自动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();

保存用户鼠标位置并使用setInterval检查每3秒如果鼠标位置改变-如果它只是保存新的鼠标位置,否则只是滚动。(我希望你已经掌握了滚动逻辑?)