Bishi finally ended, did a webapp, learn a lot from it, page useful to pull the effect of loading. I'll tidy it up today.
The implementation of pull-up loading is actually very simple:
1. Mobile-triggered Touchmove event (pull-up)
2. Determine if the last element has appeared at the bottom
3. If it appears, JS adds the element to the end of the page
Idea Map:
Next, start writing style styles:
html,body{margin:0px;width:100%;height:100%;} Li{list-style:none;} #personkit_article_ul {width:100%;p osition:relative;-webkit-padding-start:0;-webkit-margin-before:0;- webkit-margin-after:0;}. Pin{/*width:100%;*/height:90px;background-color: #eee;p adding:6px 8px;position:relative;border-bottom:1px Solid # FFF;}. personkit-article__img{width:116px;height:90px;}. Personkit-article__img img{width:100%;height:100%;}. personkit-article__info{position:absolute;left:130px;top:0px;padding:0px 8px;}. personkit-article__title{line-height:0px;} /* Multiline text overflow for ellipsis processing */.personkit-article__info p{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;- webkit-line-clamp:3;-webkit-box-orient:vertical;}. Bottom-line{text-align:center;background-color: #eee;}
HTML structure:
<section id= "Item" ><ul id= "Personkit_article_ul" ><li class= "pin" ><div class= " Personkit-article__img "></div><div class=" Personkit-article__info ">JS is implemented using the Zepto.js library:
<script src= ". /public/zepto.js "></script>
;(function () {$ (' #personkit_article_ul '). On (' Touchmove ', function () {///determines whether the last element is above the bottom if ($ ('. Pin '). EQ ($ ('. Pin '). length-1). Offset (). top-$ (window). ScrollTop () < $ (window). Height ()) {$ ('. Bottom-line '). CSS (' Display ', ' block '). Text (' refreshing ... '); Checkpull ();}}); /Add Element Method function Checkpull () {var pinnew;pinnew=document.createdocumentfragment ();//Add 5 content per time for (Var j=5;j>0;j--) {var li=document.createelement (' Li '); li.classname= "pin"; li.innerhtml= ' <div class= "personkit-article__img" > </div><div class=" Personkit-article__info ">The effect is to simulate the mobile side, the test can use Google browser-mail-review elements, click on the above already punctuate to see the effect
Achieve mobile pull-up loading effect