Home > Article > Web Front-end > jquery uses iscroll to implement pull-up and pull-down loading and refreshing example sharing
This article mainly introduces in detail how jquery uses iscorll to implement pull-up and pull-down loading and refreshing. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.
The example in this article shares with you the specific code of iscorll to implement pull-up and pull-down loading and refreshing for your reference. The specific content is as follows
The implementation principle is: judge fiiptop, flipdown Whether to display as based on
myScroll = new iScroll('wraphome', { fixedScrollbar: true, hideScrollbar: true, fadeScrollbar: true, hScrollbar: false, vScrollbar: true, onScrollMove: function () { var topstat = $(".fliptop").is(":visible"); var downstat = $(".flipdown").is(":visible"); if (this.y > 15 && !topstat && !downstat) { $(".fliptop").fadeIn(300); } else if (this.y < 15 && topstat) { $(".fliptop").hide(); } else if (this.y < (this.maxScrollY - 25) && !topstat && !downstat) { $(".flipdown").fadeIn(300); this.refresh(); //这里是当显示正在加载中时刷新底部位置 } else if (this.y > (this.maxScrollY + 25) && downstat) { $(".flipdown").hide(); } }, onTouchEnd: function () { var topstat = $(".fliptop").is(":visible"); var downstat = $(".flipdown").is(":visible"); if (topstat && !downstat) { $(".fliptop").html("正在加载中……"); setTimeout(function(){ //此处为你自己的逻辑方法 },3000); } else if (downstat && !topstat) { $(".flipdown").html("正在加载中……"); setTimeout(function(){ //此处为你自己的逻辑方法 },3000); } } });
Page section
<p id="wraphome" class="scroll"> <p class="scroll-inner"> <p class="fliptop">松手开始加载...</p> <p class="list"> ............. </p> <p class="flipdown">松手开始加载...</p> </p> </p>
Related recommendations:
What is iScroll? Detailed explanation of iScroll usage examples
iscroll implementation of pull-down and pull-up refresh tutorial
##JQuery plug-in iScroll implements pull-down refresh and scrolling page turning effects_ jquery
The above is the detailed content of jquery uses iscroll to implement pull-up and pull-down loading and refreshing example sharing. For more information, please follow other related articles on the PHP Chinese website!