My favorites | Sign in
Project Home Downloads Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 22 attachment: index.html (5.6 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<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=no, 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-translucent" />
<title>Scrolling DIV demo on iPhone / iPod Touch / Android / iPad</title>

<script type="text/javascript" src="../../src/iscroll.js?v3.6b1"></script>

<script type="text/javascript">
var myScroll;

function setHeight() {
var headerH = document.getElementById('header').offsetHeight;
var footerH = document.getElementById('footer').offsetHeight;
var wrapperH = window.innerHeight - headerH - footerH;
document.getElementById('wrapper').style.height = wrapperH + 'px';
}

function loaded() {
setHeight();

myScroll = new iScroll('scroller', {bounce: false});

/* myScroll = myScroll.destroy(); // Destroy the iScroll */
}

window.addEventListener('onorientationchange' in window ? 'orientationchange' : 'resize', setHeight, false);
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;
border:0;
}

body {
font-size:12px;
-webkit-user-select:none;
-webkit-text-size-adjust:none;
/* -webkit-box-sizing:border-box;*/
font-family:helvetica;
/* padding-bottom:44px; /* This prevents the scroller to lock if the user swipes down outside of the screen.
NOT needed if in home screen mode. */
}

#header {
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));
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);
}

#footer {
width:100%;
height:48px;
background-image:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0, #999), color-stop(0.02, #666), color-stop(1, #222));;
padding:0;
border-top:1px solid #444;
}

#footer li {
display:block;
float:left;
}

#footer li {
width:50%;
text-align:center;
}

#footer a.remove {
border-right:1px solid #333;
}

#footer a.add {
border-left:1px solid #6a6a6a;
}

#footer a {
display:block;
text-decoration:none;
font-size:12px;
color:#eee;
line-height:24px;
text-shadow:0 -1px 0 #000;
}

#footer span {
display:block;
font-size:30px;
font-weight:bold;
}

#wrapper {
height:200px; /* Of course you need to specify the object height */

position:relative; /* On older OS versions "position" and "z-index" must be defined, */
z-index:1; /* it seems that recent webkit is less picky and works anyway. */

width:100%;
background:#aaa;
overflow:hidden;
/* background:#aaa url(wrapper-bg.png);*/
}

#scroller {
/* -webkit-touch-callout:none;*/
/* -webkit-tap-highlight-color:rgba(0,0,0,0);*/

float:left;
width:100%;
padding:0;

/* -webkit-box-shadow:0 0 8px #555; /* Don't use box shadows, they slow down drastically CSS animations */
}

#scroller ul {
list-style:none;
padding:0;
margin:0;
width:100%;
text-align:left;
}

#scroller li {
padding:0 10px;
height:40px;
line-height:40px;
border-bottom:1px solid #ccc;
border-top:1px solid #fff;
background-color:#fafafa;
/* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#d4d4d4), to(#fafafa));*/
font-size:14px;
}

fieldset {
display:block; float:left;
width:100%;
}
</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><a href="#" onclick="myScroll.scrollToElement('#row10');return false">Scroll to row 10 (default runtime)</a></li>
<li>Pretty content row 2</li>
<li>Pretty content row 3</li>
<li>Pretty content row 4</li>
<!-- <li>Pretty content row 5</li>-->
<!-- <li>Pretty content row 6</li>-->
<!-- <li>Pretty content row 7</li>-->
<!-- <li>Pretty content row 8</li>-->
<!-- <li>Pretty content row 9</li>-->
<!-- <li id="row10"><a href="#" onclick="myScroll.scrollToElement('#scroller > ul > li:last-child', '0s');return false">Go to bottom (skip to, no animation)</a></li>-->
<!-- <li>Pretty content row 11</li>-->
<!-- <li>Pretty content row 12</li>-->
<!-- <li>Pretty content row 13</li>-->
<!-- <li>Pretty content row 14</li>-->
<!-- <li>Pretty content row 15</li>-->
<!-- <li>Pretty content row 16</li>-->
<!-- <li>Pretty content row 17</li>-->
<!-- <li>Pretty content row 18</li>-->
<!-- <li>Pretty content row 19</li>-->
<!-- <li><a href="#" onclick="myScroll.scrollToElement('#scroller > ul > li', '1s');return false">Go back to top (1s runtime)</a></li>-->
</ul>
</div>
</div>

<div id="footer"><ul><li><a class="remove" href="#" ontouchend="document.getElementById('thelist').removeChild(document.getElementById('thelist').getElementsByTagName('li')[document.getElementById('thelist').getElementsByTagName('li').length-1]);return false;"><span>–</span>remove row</a></li><li><a class="add" href="#" ontouchend="document.getElementById('thelist').appendChild(document.createElement('li')).innerText = 'Pretty content row ' + document.getElementById('thelist').getElementsByTagName('li').length;return false;"><span>+</span>add row</a></li></ul></div>
<div id="test"><div></div></div>
</body>
</html>
Powered by Google Project Hosting