【发布时间】:2014-07-17 03:23:33
【问题描述】:
我在http://dev.bit.co.in上添加了iScroll库
我已经设置了最低限度。整个正文内容由
封装<div id="wrapper">
<div id="scroller">
...
</div>
</div>
我把这个放在头上:
<script type="text/javascript" src="/themes/bit.co.in/js/iscroll-master/build/iscroll.js"></script>
<script type="text/javascript">
var myScroll;
function loaded () {
myScroll = new IScroll('#wrapper');
}
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
</script>
另外,我在 body 标签中添加了 onload="loaded()" 并在 CSS 中添加了这个:
@media (max-width: 430px) {
body {
/* On modern browsers, prevent the whole page to bounce */
overflow: hidden;
}
#wrapper {
position: relative;
width: 300px;
height: 300px;
overflow: hidden;
/* Prevent native touch events on Windows */
-ms-touch-action: none;
/* Prevent the callout on tap-hold and text selection */
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
/* Prevent text resize on orientation change, useful for web-apps */
-webkit-text-size-adjust: none;
-moz-text-size-adjust: none;
-ms-text-size-adjust: none;
-o-text-size-adjust: none;
text-size-adjust: none;
}
#scroller {
position: absolute;
/* Prevent elements to be highlighted on tap */
-webkit-tap-highlight-color: rgba(0,0,0,0);
/* Put the scroller into the HW Compositing layer right from the start */
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
-o-transform: translateZ(0);
transform: translateZ(0);
}
}
这些是 iscroll 推荐的准系统更改。
现在,当我在移动设备上拉起它时,它似乎根本不滚动 不幸的是。
如果您有任何想法,请告诉我。 :)
【问题讨论】:
标签: javascript jquery css iscroll