最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

iscroll動態(tài)加載數(shù)據(jù)完美解決方法

 更新時間:2017年07月18日 09:15:16   作者:成大大  
這篇文章主要為大家詳細(xì)介紹了iscroll動態(tài)加載數(shù)據(jù)的完美解決方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了iscroll動態(tài)加載數(shù)據(jù)的具體代碼,供大家參考,具體內(nèi)容如下

<div id="wrapper" class="margin-b90">
    <div id="scroller">
      <div id="pullDown">
        <span class="pullDownLabel" style="text-align: center;">加載中...</span>
      </div>
      <div class="sps_itemBox ">
        <div class="list_show">
          <ul id="ulList"></ul>
        </div>
      </div>

      <div id="pullUp">
        <span class="pullUpLabel" style="text-align: center;">上拉加載...</span>
      </div>
    </div>
  </div>

js.

// iScroll 滾動條/上拉刷新/下拉加載
var myScroll,
pullDownEl,
pullDownOffset,
pullUpEl,
pullUpOffset;

function loaded() {
pullDownEl = document.getElementById('pullDown');
pullDownOffset = pullDownEl.offsetHeight;
pullUpEl = document.getElementById('pullUp');
pullUpOffset = pullUpEl.offsetHeight;
myScroll = new iScroll('wrapper', {
useTransition: false,
topOffset: pullDownOffset,
btnOffset: pullUpOffset,
hideScrollbar: true,
fadeScrollbar: true,
onRefresh: function () {
if (pullDownEl.className.match('loading')) {
pullDownEl.className = '';
//pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
pullDownEl.querySelector('.pullDownLabel').innerHTML = '數(shù)據(jù)更新時間:' + updateDatetime;
} else if (pullUpEl.className.match('loading')) {
pullUpEl.className = '';
pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加載...';
}
},
onScrollMove: function () {
if (this.y > 5 && !pullDownEl.className.match('flip')) {
pullDownEl.className = 'flip';
//pullDownEl.querySelector('.pullDownLabel').innerHTML = '釋放刷新...';
pullDownEl.querySelector('.pullDownLabel').innerHTML = '數(shù)據(jù)更新時間:' + updateDatetime;
this.minScrollY = 0;
} else if (this.y < 5 && pullDownEl.className.match('flip')) {
pullDownEl.className = '';
//pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
pullDownEl.querySelector('.pullDownLabel').innerHTML = '數(shù)據(jù)更新時間:' + updateDatetime;
this.minScrollY = -pullDownOffset;
} else if (this.y < (this.maxScrollY - pullUpOffset - 40) && !pullUpEl.className.match('flip')) {
pullUpEl.className = 'flip';
pullUpEl.querySelector('.pullUpLabel').innerHTML = '釋放加載...';
this.maxScrollY = this.maxScrollY - pullUpOffset;
}
//else if (this.y > (this.maxScrollY - pullUpOffset) && pullUpEl.className.match('flip')) {
// pullUpEl.className = '';
// pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加載...';
// //this.maxScrollY = pullUpOffset;
//}
},
onScrollEnd: function () {
if (pullDownEl.className.match('flip')) {
pullDownEl.className = 'loading';
//pullDownEl.querySelector('.pullDownLabel').innerHTML = '數(shù)據(jù)刷新中...';
pullDownEl.querySelector('.pullDownLabel').innerHTML = '數(shù)據(jù)更新時間:' + updateDatetime;
myScroll.refresh();
} else if (pullUpEl.className.match('flip')) { 
pullUpEl.className = 'loading';
pullUpEl.querySelector('.pullUpLabel').innerHTML = '數(shù)據(jù)加載中...';
setTimeout(function () { myScroll.refresh(); }, 3000);

}
}
});
}
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);

css

/* iScroll */
#wrapper{width:100%; position:absolute; top:0; bottom:0; z-index:1; overflow:hidden;}
#scroller{
  width:100%; position:absolute; z-index:1;
  -webkit-touch-callout:none; -webkit-tap-highlight-color:rgba(0,0,0,0);
}
#pullDown,
#pullUp{padding:15px 0 15px 60px; font-size:14px; line-height:27px; color:#303030;}
#pullDown{background:url(../images/loadBottom.png) no-repeat 30px center; background-size:27px 27px;}
#pullUp{background:url(../images/loadTop.png) no-repeat 30px center; background-size:27px 27px;}
#pullDown.flip{background:url(../images/loadTop.png) no-repeat 30px center; background-size:27px 27px;}
#pullUp.flip{background:url(../images/loadBottom.png) no-repeat 30px center; background-size:27px 27px;}
#pullDown.loading,
#pullUp.loading{background:url(../images/loading.gif) no-repeat 30px center; background-size:25px 27px;}
/* iScroll end */

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

锦州市| 凤阳县| 江油市| 北京市| 江油市| 运城市| 昆明市| 金华市| 石家庄市| 张家港市| 那曲县| 苍溪县| 札达县| 靖安县| 威宁| 渝北区| 乌兰察布市| 虎林市| 万山特区| 西乌珠穆沁旗| 宁陵县| 遂平县| 黄石市| 钟祥市| 肥东县| 望谟县| 五家渠市| 新泰市| 郸城县| 梨树县| 中卫市| 紫阳县| 轮台县| 介休市| 西乡县| 东山县| 平利县| 古田县| 嵩明县| 阿拉善盟| 龙胜|