javascript - scroll in both directions with iScroll -


i make image slide momentum freely in direction (no snap).

i came across iscroll4, great script (works great on ios , android).

js code:

var myscroll; function loaded() {  myscroll = new iscroll('wrapper',                  { hscrollbar: false,                      vscrollbar: false,                     snap:false,                     vscroll: true,                     hscroll: true                      }); } 

html code:

<div id="wrapper">     <div id="scroller">         <div id="thelist">             <img id="theimg" src="https://www.google.com/images/srpr/logo4w.png" width="300px" height="200px">         </div>     </div> </div> 

css:

body,ul,li { padding:0; margin:0; border:0; }   #wrapper { position:absolute;  z-index:1; top:-500px;  bottom:0px;  left:-500px; width: 100%; height: 100%; overflow:auto; background-color: red; }  #scroller { position:absolute;  z-index:1; padding:0; width: 2000px; height: 5000px; background-color: blue;  }  #thelist { list-style:none; padding:0; margin:0; text-align:left; background:none; background-color: yellow; }  #thecontent { background-color: grey; }  #theimg { position: relative; top: 500px; left: 500px; } 

i tried make wrapper bigger screen, image can slide outside screen, , make image in relative position, it's visible on screen.

but can't seem rid of top or left snapping.

what doing wrong here ?

alternatively, there library can same job ?


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -