Iscroll5快照功能无法准确地为Phonegap应用程序工作

时间:2013-07-04 07:43:01

标签: javascript html css cordova iscroll

我正在使用Phonegap开发应用程序。

我有十张图片,我使用iscroll5滚动它们。有时快照会跳过一些img元素,我不知道为什么会这样做。图像大小不同。

以下是我使用的代码片段:

  <html>
      <head>
          <meta 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">

       <title>iScroll demo: carousel</title>

     <script type="text/javascript" src="iscroll.js"></script>

  <script type="text/javascript">

  var myScroll;

   function loaded () {
        myScroll = new IScroll('#wrapper', {
    scrollX: true,
    scrollY: false,
    momentum: false,
    snap:"img",
    snapSpeed: 400,
    keyBindings: true

});

}

   document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
  </script>


  <style type="text/css">
  #wrapper {
width: 200px;
height: 240px;
margin: 0 auto;
  }

  #scroller {
   position: absolute;
   z-index: 1;
   -webkit-tap-highlight-color: rgba(0,0,0,0);
   width: 800px;
   height: 240px;
  -webkit-transform: translateZ(0);
   -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: none;
  -moz-text-size-adjust: none;
  -ms-text-size-adjust: none;
  -o-text-size-adjust: none;
  text-size-adjust: none;
  background-color: #444;
    }

  #scroller img{
        margin:0px;
        padding:0px;

            }

     </style>
           </head>

 <body onload="loaded()">

              <div id="wrapper">
                       <div id="scroller">
                         <div><img src="img1.png></div>
                          <div><img src="img2.png></div>
                                      <div><img src="img3.png></div>
                                      <div><img src="img4.png></div>
                          <div><img src="img5.png></div>
                          <div><img src="img6.png></div>
                                      <div><img src="img7.png></div>
                                      <div><img src="img8.png></div>
                          <div><img src="img9.png></div>
                           <div><img src="img10.png></div>

    </div>
  </div>

                </body>
                      </html>

0 个答案:

没有答案