上篇文章使用html5的touch事件把简单的滑动做出来了,实现了持续页面上下滑动的效果,参考之前的文章及代码html5 touch事件实现触屏页面上下滑动(一)
本文主要实现了一个效果:页面滑动到最上面和最下面的时候阻止其再继续滑动;
因为给页面添加了touch事件那么滚动条等其他页面原有的默认属性将别改变,上篇文章里的 demo可以一直向上滑动或向下滑动,但现实是这样是不可取的
完整代码:XML/HTML Code复制内容到剪贴板html>
2014-5-4* {margin: 0; padding: 0;}
#outer{ width:90%; height: 490px; background: #000; margin: auto; overflow: hidden;}
#inner{width:80%; background: #e4e4e4; margin: auto; position:relative; top:0px; font-size: 1em; padding: 30px 10px; }
#inner p{line-height: 30px; letter-spacing: 3px; text-indent:2em;}
#spText{ height: 40px; width: 100%;border:1px solid red;}
h2{ width: 100%; text-align: center; }
h3{ width: 100%; padding-left:60%;}