| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"> |
| 6 | |
| 7 | <title>iScroll demo: horizontal scrolling</title> |
| 8 | |
| 9 | <script type="text/javascript" src="../../build/iscroll.js"></script> |
| 10 | |
| 11 | <script type="text/javascript"> |
| 12 | |
| 13 | var myScroll; |
| 14 | |
| 15 | function loaded () { |
| 16 | myScroll = new IScroll('#wrapper', { scrollX: true, scrollY: false, mouseWheel: true }); |
| 17 | } |
| 18 | |
| 19 | document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); |
| 20 | |
| 21 | </script> |
| 22 | |
| 23 | <style type="text/css"> |
| 24 | * { |
| 25 | -webkit-box-sizing: border-box; |
| 26 | -moz-box-sizing: border-box; |
| 27 | box-sizing: border-box; |
| 28 | } |
| 29 | |
| 30 | html { |
| 31 | -ms-touch-action: none; |
| 32 | } |
| 33 | |
| 34 | body,ul,li { |
| 35 | padding: 0; |
| 36 | margin: 0; |
| 37 | border: 0; |
| 38 | } |
| 39 | |
| 40 | body { |
| 41 | font-size: 12px; |
| 42 | font-family: ubuntu, helvetica, arial; |
| 43 | overflow: hidden; /* this is important to prevent the whole page to bounce */ |
| 44 | } |
| 45 | |
| 46 | #header { |
| 47 | position: absolute; |
| 48 | z-index: 2; |
| 49 | top: 0; |
| 50 | left: 0; |
| 51 | width: 100%; |
| 52 | height: 45px; |
| 53 | line-height: 45px; |
| 54 | background: #CD235C; |
| 55 | padding: 0; |
| 56 | color: #eee; |
| 57 | font-size: 20px; |
| 58 | text-align: center; |
| 59 | font-weight: bold; |
| 60 | } |
| 61 | |
| 62 | #footer { |
| 63 | position: absolute; |
| 64 | z-index: 2; |
| 65 | bottom: 0; |
| 66 | left: 0; |
| 67 | width: 100%; |
| 68 | height: 48px; |
| 69 | background: #444; |
| 70 | padding: 0; |
| 71 | border-top: 1px solid #444; |
| 72 | } |
| 73 | |
| 74 | #wrapper { |
| 75 | position: absolute; |
| 76 | z-index: 1; |
| 77 | top: 45px; |
| 78 | bottom: 48px; |
| 79 | left: 0; |
| 80 | width: 100%; |
| 81 | background: #ccc; |
| 82 | overflow: hidden; |
| 83 | } |
| 84 | |
| 85 | #scroller { |
| 86 | position: absolute; |
| 87 | z-index: 1; |
| 88 | -webkit-tap-highlight-color: rgba(0,0,0,0); |
| 89 | width: 5000px; |
| 90 | height: 100%; |
| 91 | background-color: #a00; |
| 92 | -webkit-transform: translateZ(0); |
| 93 | -moz-transform: translateZ(0); |
| 94 | -ms-transform: translateZ(0); |
| 95 | -o-transform: translateZ(0); |
| 96 | transform: translateZ(0); |
| 97 | -webkit-touch-callout: none; |
| 98 | -webkit-user-select: none; |
| 99 | -moz-user-select: none; |
| 100 | -ms-user-select: none; |
| 101 | user-select: none; |
| 102 | -webkit-text-size-adjust: none; |
| 103 | -moz-text-size-adjust: none; |
| 104 | -ms-text-size-adjust: none; |
| 105 | -o-text-size-adjust: none; |
| 106 | text-size-adjust: none; |
| 107 | } |
| 108 | |
| 109 | #scroller ul { |
| 110 | list-style: none; |
| 111 | padding: 0; |
| 112 | margin: 0; |
| 113 | width: 100%; |
| 114 | height: 100%; |
| 115 | text-align: center; |
| 116 | } |
| 117 | |
| 118 | #scroller li { |
| 119 | display: block; |
| 120 | float: left; |
| 121 | width: 100px; |
| 122 | height: 100%; |
| 123 | border-right: 1px solid #ccc; |
| 124 | background-color: #fafafa; |
| 125 | font-size: 14px; |
| 126 | } |
| 127 | |
| 128 | </style> |
| 129 | </head> |
| 130 | <body onload="loaded()"> |
| 131 | <div id="header">iScroll</div> |
| 132 | |
| 133 | <div id="wrapper"> |
| 134 | <div id="scroller"> |
| 135 | <ul> |
| 136 | <li>Cell 1</li> |
| 137 | <li>Cell 2</li> |
| 138 | <li>Cell 3</li> |
| 139 | <li>Cell 4</li> |
| 140 | <li>Cell 5</li> |
| 141 | <li>Cell 6</li> |
| 142 | <li>Cell 7</li> |
| 143 | <li>Cell 8</li> |
| 144 | <li>Cell 9</li> |
| 145 | <li>Cell 10</li> |
| 146 | <li>Cell 11</li> |
| 147 | <li>Cell 12</li> |
| 148 | <li>Cell 13</li> |
| 149 | <li>Cell 14</li> |
| 150 | <li>Cell 15</li> |
| 151 | <li>Cell 16</li> |
| 152 | <li>Cell 17</li> |
| 153 | <li>Cell 18</li> |
| 154 | <li>Cell 19</li> |
| 155 | <li>Cell 20</li> |
| 156 | <li>Cell 21</li> |
| 157 | <li>Cell 22</li> |
| 158 | <li>Cell 23</li> |
| 159 | <li>Cell 24</li> |
| 160 | <li>Cell 25</li> |
| 161 | <li>Cell 26</li> |
| 162 | <li>Cell 27</li> |
| 163 | <li>Cell 28</li> |
| 164 | <li>Cell 29</li> |
| 165 | <li>Cell 30</li> |
| 166 | <li>Cell 31</li> |
| 167 | <li>Cell 32</li> |
| 168 | <li>Cell 33</li> |
| 169 | <li>Cell 34</li> |
| 170 | <li>Cell 35</li> |
| 171 | <li>Cell 36</li> |
| 172 | <li>Cell 37</li> |
| 173 | <li>Cell 38</li> |
| 174 | <li>Cell 39</li> |
| 175 | <li>Cell 40</li> |
| 176 | <li>Cell 41</li> |
| 177 | <li>Cell 42</li> |
| 178 | <li>Cell 43</li> |
| 179 | <li>Cell 44</li> |
| 180 | <li>Cell 45</li> |
| 181 | <li>Cell 46</li> |
| 182 | <li>Cell 47</li> |
| 183 | <li>Cell 48</li> |
| 184 | <li>Cell 49</li> |
| 185 | <li>Cell 50</li> |
| 186 | </ul> |
| 187 | </div> |
| 188 | </div> |
| 189 | |
| 190 | <div id="footer"></div> |
| 191 | |
| 192 | </body> |
| 193 | </html> |