網頁滾動到底部,拉取資料

來源:互聯網
上載者:User

標籤:自動   eval   取資料   非同步   swipe   var   視窗   事件   dex   

網頁滾動模式
//滾到到底部自動拉取資料        //頁面滾到底部非同步載入下一頁資料        $(window).scroll(function () {            //已經滾動到上面的頁面高度            var scrollTop = parseFloat($(this).scrollTop()),                //頁面高度                scrollHeight = $(document).height(),                //瀏覽器視窗高度                windowHeight = parseFloat($(this).height()),                totalHeight = scrollTop + windowHeight;            //此處是捲軸到底部時候觸發的事件,在這裡寫要載入的資料,或者是拉動捲軸的操作            if (scrollTop + windowHeight >= scrollHeight - 0.7) {                var index = $(‘.swiper-slide-active‘).data("index");                var id = $(‘.swiper-slide-active‘).attr("id");                eval(‘‘+id+‘(‘+Number(index)+1+‘,‘+pageNumber+‘,"‘+userid+‘")‘);            }        });
可滾動的元素 ,滾動到底部,觸發擷取資料
//滾到到底部自動拉取資料        //頁面滾到底部非同步載入下一頁資料        $(".swiper-slide").scroll(function () {            //已經滾動到上面的頁面高度            var scrollTop = parseFloat($(this).scrollTop()),                //滾動高度                scrollHeight = this.scrollHeight,                //視窗高度                windowHeight = $(this).height(),                totalHeight = scrollTop + windowHeight;            //此處是捲軸到底部時候觸發的事件,在這裡寫要載入的資料,或者是拉動捲軸的操作            if (scrollTop + windowHeight >= scrollHeight - 0.7) {                console.log("===");                var nextIndex = Number($(‘.swiper-slide-active‘).data("index"))+1;                var id = $(‘.swiper-slide-active‘).attr("id");                eval(‘‘ + id + ‘(‘ + nextIndex + ‘,‘ + pageNumber + ‘,"‘ + userid + ‘")‘);            }        });

  

網頁滾動到底部,拉取資料

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.