UNPKG

iscroll

Version:

smooth scrolling for mobile webkit

134 lines (118 loc) 2.92 kB
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; 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"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <title>iScroll demo: horizontal scroll</title> <script type="application/javascript" src="../../src/iscroll.js"></script> <script type="text/javascript"> var myScroll; function loaded() { myScroll = new iScroll('wrapper'); } document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); document.addEventListener('DOMContentLoaded', loaded, false); </script> <style type="text/css" media="all"> body,ul,li { padding:0; margin:0; } body { font-size:12px; -webkit-user-select:none; -webkit-text-size-adjust:none; /* -webkit-box-sizing:border-box;*/ font-family:helvetica; /* padding-bottom:45px; /* This prevents the scroller to lock if the user swipes down outside of the screen. NOT needed if in home screen mode. */ } #header { position:absolute; z-index:2; top:0; left:0; width:100%; height:45px; line-height:45px; background-image:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0, #fe96c9), color-stop(0.05, #d51875), color-stop(1, #7b0a2e)); background-image:-moz-linear-gradient(top, #fe96c9, #d51875 5%, #7b0a2e); background-image:-o-linear-gradient(top, #fe96c9, #d51875 5%, #7b0a2e); padding:0; color:#eee; font-size:20px; text-align:center; } #header a { color:#f3f3f3; text-decoration:none; font-weight:bold; text-shadow:0 -1px 0 rgba(0,0,0,0.5); } #wrapper { position:absolute; z-index:1; top:45px; bottom:0; left:0; width:100%; background:#aaa; overflow:auto; } #scroller { width:2040px; height:100%; float:left; padding:0; } #scroller ul { list-style:none; display:block; float:left; width:100%; height:100%; padding:0; margin:0; text-align:left; } #scroller li { display:block; vertical-align:middle; float:left; padding:0 10px; width:80px; height:100%; border-left:1px solid #ccc; border-right:1px solid #fff; background-color:#fafafa; font-size:14px; } </style> </head> <body> <div id="header"><a href="http://cubiq.org/iscroll">iScroll</a></div> <div id="wrapper"> <div id="scroller"> <ul id="thelist"> <li>Pretty col 1</li> <li>Pretty col 2</li> <li>Pretty col 3</li> <li>Pretty col 4</li> <li>Pretty col 5</li> <li>Pretty col 6</li> <li>Pretty col 7</li> <li>Pretty col 8</li> <li>Pretty col 9</li> <li>Pretty col 10</li> <li>Pretty col 11</li> <li>Pretty col 12</li> <li>Pretty col 13</li> <li>Pretty col 14</li> <li>Pretty col 15</li> <li>Pretty col 16</li> <li>Pretty col 17</li> <li>Pretty col 18</li> <li>Pretty col 19</li> <li>Pretty col 20</li> </ul> </div> </div> </body> </html>