JS jQuery滚动条下拉到底触发事件

var edit=true;//可控元素
        $(window).scroll(
                function () {
                    var scrollTop = $(this).scrollTop();
                    var scrollHeight = $(document).height();
                    var windowHeight = $(this).height();
                    if (scrollTop + windowHeight+100 >= scrollHeight && edit) {
                        edit=false;
                        console.log(“来,跟着一起。哈哈哈哈哈哈”);
                        setTimeout("edit=true;",1000);
                    }else{
                        console.log(scrollTop);
                        console.log(windowHeight);
                        console.log(scrollHeight);
                    }
                }
        );

猜你喜欢

转载自blog.csdn.net/Purgatory001/article/details/82349229