主页 > 前端 > javascript >
来源:未知 时间:2016-07-03 19:10 作者:xxadmin 阅读:次
[导读] isscroll移动端滚动插件,下面是加载更多列子 !DOCTYPEhtmlhtmlheadmetahttp-equiv=Content-Typecontent=text/html;charset=utf-8titleiScrolldemo:simple/titlescripttype=text/javascriptsrc=iscroll.js/scriptscripttype=text/javascript...
isscroll移动端滚动插件,下面是加载更多列子 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>iScroll demo: simple</title> <script type="text/javascript" src="iscroll.js"></script> <script type="text/javascript"> var myScroll = null; var generatedCount = 0; function pullUpAction () { var el, li, i; el = document.getElementById('thelist'); for (i=0; i<3; i++) { li = document.createElement('li'); li.innerText = 'Generated row ' + (++generatedCount); el.appendChild(li, el.childNodes[0]); } myScroll.refresh(); // Remember to refresh when contents are loaded (ie: on ajax completion)! } window.onload = function() { myScroll = new iScroll('wrapper', { onScrollEnd: function () { //如果滑动到底部,则加载更多数据(距离最底部10px高度) if ((this.y - this.maxScrollY) > 10) { pullUpAction(); } } }); for (var n=0; n<10; n++) { pullUpAction(); } } document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); </script> <style type="text/css" media="all"> #wrapper1 { height:300px; } #scroller1 li { height:40px; line-height:40px; } </style> </head> <body> <div id="wrapper"> <div id="scroller"> <ul id="thelist"> </ul> </div> </div> </body> </html> |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com