Home > Web Front-end > JS Tutorial > jquery uses iscorll to implement pull-up loading and pull-down refresh on the mobile phone

jquery uses iscorll to implement pull-up loading and pull-down refresh on the mobile phone

php中世界最好的语言
Release: 2018-04-19 14:43:09
Original
3191 people have browsed it

This time I will bring you jqueryUsing iscorll to implement pull-up, load, and pull-down refresh on the mobile phone. jquery uses iscorll to implement pull-up, load, and pull-down refresh on the mobile phone. NotesWhat are they? The following is a practical case. Let’s take a look.

The implementation principle is: judging whether fiiptop and flipdown are displayed as the basis

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); 
          } 
 
        } 
      });
Copy after login

Page part

<p id="wraphome" class="scroll"> 
   <p class="scroll-inner"> 
     <p class="fliptop">松手开始加载...</p> 
     <p class="list"> 
        ............. 
     </p> 
     <p class="flipdown">松手开始加载...</p> 
   </p> 
</p>
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:



The above is the detailed content of jquery uses iscorll to implement pull-up loading and pull-down refresh on the mobile phone. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template