前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >jQuery手机端上拉下拉刷新页面源码

jQuery手机端上拉下拉刷新页面源码

作者头像
用户5997198
发布2019-08-09 11:07:04
2.3K0
发布2019-08-09 11:07:04
举报
文章被收录于专栏:蚂蚁开源社区

<!DOCTYPE html> <html> <head> <title>jQuery手机端上拉下拉刷新页面代码 - 蚂蚁社区-开源源码社区</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <link rel="stylesheet" href="reset.css"/> <link rel="stylesheet" href="pullToRefresh.css"/> <script src="iscroll.js"></script> <script src="pullToRefresh.js"></script> <script src="colorful.js"></script> <style type="text/css" media="all"> body, html { padding: 0; margin: 0; height: 100%; font-family: Arial, Microsoft YaHei; color: #111; } li { /*border-bottom: 1px #CCC solid;*/ text-align: center; line-height: 80px; } </style> </head> <body> <!--must content ul li,or shoupi--> <div id="wrapper"> <ul> <li>row 10</li> <li>row 9</li> <li>row 8</li> <li>row 7</li> <li>row 6</li> <li>row 5</li> <li>row 4</li> <li>row 3</li> <li>row 2</li> <li>row 1</li> </ul> </div> <script> for(var i=0;i<document.querySelectorAll("#wrapper ul li").length;i++){ document.querySelectorAll("#wrapper ul li")[i].colorfulBg(); } refresher.init({ id:"wrapper",//<------------------------------------------------------------------------------------┐ pullDownAction:Refresh, pullUpAction:Load }); var generatedCount = 0; function Refresh() { setTimeout(function () { // <-- Simulate network congestion, remove setTimeout from production! var el, li, i; el =document.querySelector("#wrapper ul"); el.innerHTML=''; for (i=0; i<11; i++) { li = document.createElement('li'); li.appendChild(document.createTextNode('async row ' + (++generatedCount))); el.insertBefore(li, el.childNodes[0]); } wrapper.refresh();/****remember to refresh after action completed! ---yourId.refresh(); ----| ****/ for(var i=0;i<document.querySelectorAll("#wrapper ul li").length;i++){ document.querySelectorAll("#wrapper ul li")[i].colorfulBg(); } }, 1000); } function Load() { setTimeout(function () {// <-- Simulate network congestion, remove setTimeout from production! var el, li, i; el =document.querySelector("#wrapper ul"); for (i=0; i<2; i++) { li = document.createElement('li'); li.appendChild(document.createTextNode('async row ' + (++generatedCount))); el.appendChild(li, el.childNodes[0]); } wrapper.refresh();/****remember to refresh after action completed!!! ---id.refresh(); --- ****/ for(var i=0;i<document.querySelectorAll("#wrapper ul li").length;i++){ document.querySelectorAll("#wrapper ul li")[i].colorfulBg(); } }, 1000); } </script> <div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';"> <p>适用浏览器:360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. 不支持IE8及以下浏览器。</p> <p>来源:<a href="http://www.zzfriend.com" target="_blank">蚂蚁社区-开源源码社区</a></p> </div> <div style="display:none"> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?cbf20f554ba43aeba396a009eb4ab5f7"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </div> </body> </html>

—— END ——

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2019-01-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 蚂蚁大喇叭 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档