跳到主要內容

發表文章

目前顯示的是 5月, 2016的文章

[JS/JQ] 捲動卷軸 增加結果 (一直拉捲動,顯示越來越多)

//捲到底次數(像分頁一樣) var sindex; $(function () {       //begin get data from 1.     sindex = 1;     showDetial(sindex);     $(window).scroll(function () {         var $BodyHeight = $(document).height();         var $ViewportHeight = $(window).height();         $ScrollTop = $(this).scrollTop();         if ($BodyHeight == ($ViewportHeight + $ScrollTop)) {             //scroll bar then add search index.             sindex++;             //get data.             showDetial(sindex);         }     });     //avoid click F5 when scrollerbar not in bottom then default run scroll that have same data, so this check user if click buttom that scroll to top.     $(window).keydown(function (e) {         //e.which code 116 = F5.         if (e.which == 116) {             $('html, body').scrollTop(0);         }     }); }); //get data function showDetial(sindex) {     $.ajax({         url: " / ",         type: 'POST',         data: { page: sindex },