My favorites
▼
|
Sign in
iscroll-js
The overflow:scroll for mobile webkit
Project Home
Downloads
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
50
attachment: indexTest.html
(5.1 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
<!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.7.1"></script>
<script type="text/javascript">
var myScroll;
var a = 0;
function loaded() {
setHeight(); // Set the wrapper height. Not strictly needed, see setHeight() function below.
// Please note that the following is the only line needed by iScroll to work. Everything else here is to make this demo fancier.
myScroll = new iScroll('scroller', {desktopCompatibility:true});
}
// Change wrapper height based on device orientation. Not strictly needed by iScroll, you may also use pure CSS techniques.
function setHeight() {
var headerH = document.getElementById('header').offsetHeight,
footerH = document.getElementById('footer').offsetHeight,
wrapperH = window.innerHeight - headerH - footerH;
document.getElementById('wrapper').style.height = wrapperH + 'px';
}
// Check screen size on orientation change
window.addEventListener('onorientationchange' in window ? 'orientationchange' : 'resize', setHeight, false);
// Prevent the whole screen to scroll when dragging elements outside of the scroller (ie:header/footer).
// If you want to use iScroll in a portion of the screen and still be able to use the native scrolling, do *not* preventDefault on touchmove.
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
// Load iScroll when DOM content is ready.
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;
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 and on Android. */
}
#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 (absolute | relative), */
z-index:1; /* it seems that recent webkit is less picky and works anyway. */
width:100%;
background:#aaa;
overflow:hidden;
}
#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;
font-size:14px;
}
#scroller li > a {
display:block;
}
</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>
<form>
<select name="count">
<option >1</option>
<option >2</option>
<option >3</option>
</select>
<input type="submit" value="send">
</form>
</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>
</body>
</html>
Powered by
Google Project Hosting