Elffuss BraidHub

kikocis/iscroll public

master · 2.6 KiBRawPermalink
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: starfield</title>
8
9<script type="text/javascript" src="../../build/iscroll.js"></script>
10
11<script type="text/javascript">
12
13var myScroll;
14
15function loaded () {
16 myScroll = new IScroll('#wrapper', {
17 mouseWheel: true,
18 indicators: [{
19 el: document.getElementById('starfield1'),
20 resize: false,
21 ignoreBoundaries: true,
22 speedRatioY: 0.4
23 }, {
24 el: document.getElementById('starfield2'),
25 resize: false,
26 ignoreBoundaries: true,
27 speedRatioY: 0.2
28 }]
29 });
30}
31
32document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
33
34</script>
35
36<style type="text/css">
37* {
38 -webkit-box-sizing: border-box;
39 -moz-box-sizing: border-box;
40 box-sizing: border-box;
41}
42
43html {
44 -ms-touch-action: none;
45}
46
47body,ul,li {
48 padding: 0;
49 margin: 0;
50 border: 0;
51}
52
53body {
54 font-size: 12px;
55 font-family: ubuntu, helvetica, arial;
56 overflow: hidden; /* this is important to prevent the whole page to bounce */
57 background: #000;
58}
59
60#wrapper {
61 position: absolute;
62 z-index: 3;
63 width: 100%;
64 top: 0;
65 bottom: 0;
66 left: 0;
67 overflow: hidden;
68}
69
70#scroller {
71 position: absolute;
72 z-index: 3;
73 width: 100%;
74 height: 4000px;
75 overflow: hidden;
76 -webkit-tap-highlight-color: rgba(0,0,0,0);
77 -webkit-transform: translateZ(0);
78 -moz-transform: translateZ(0);
79 -ms-transform: translateZ(0);
80 -o-transform: translateZ(0);
81 transform: translateZ(0);
82 -webkit-touch-callout: none;
83 -webkit-user-select: none;
84 -moz-user-select: none;
85 -ms-user-select: none;
86 user-select: none;
87 -webkit-text-size-adjust: none;
88 -moz-text-size-adjust: none;
89 -ms-text-size-adjust: none;
90 -o-text-size-adjust: none;
91 text-size-adjust: none;
92 background: url(galaxies1.png);
93}
94
95.starfield {
96 position: absolute;
97 width: 100%;
98 top: 0;
99 left: 0;
100 bottom: 0;
101 overflow: hidden;
102}
103
104.starfield div {
105 position: absolute;
106 width: 100%;
107 overflow: hidden;
108 -webkit-transform: translateZ(0);
109 -moz-transform: translateZ(0);
110 -ms-transform: translateZ(0);
111 -o-transform: translateZ(0);
112 transform: translateZ(0);
113}
114
115#starfield1 {
116 z-index: 2;
117}
118
119#stars1 {
120 z-index: 2;
121 height: 3000px;
122 background: url(galaxies2.png);
123}
124
125#starfield2 {
126 z-index: 1;
127}
128
129#stars2 {
130 z-index: 1;
131 height: 2000px;
132 background: url(stars.jpg);
133}
134
135</style>
136</head>
137<body onload="loaded()">
138
139<div id="wrapper">
140 <div id="scroller"></div>
141</div>
142
143<div class="starfield" id="starfield1">
144 <div id="stars1"></div>
145</div>
146
147<div class="starfield" id="starfield2">
148 <div id="stars2"></div>
149</div>
150
151</body>
152</html>