wp7.html
3.96 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
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="cleartype" content="on">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0; maximum-scale=1; minimum-scale=1; user-scalable=no;">
<title>jQuery NiceScroll Test 3 - DOJO</title>
<style type="text/css">
#boxscroll {
padding: 0px;
height: 220px;
width: 310px;
border: 2px solid #0000FF;
overflow: auto;
margin: 0px;
}
.mush {
width:4960px;
height:4200px;
background-image:url(img/mariomushrooms.png);
}
.bgm {
background-image:url(img/mariomushrooms2.png);
}
body {
font-family: georgia,serif;
margin:2px;
}
.header {
width: 320px;
text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.9);
}
</style>
</style>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.nicescroll.min.js"></script>
<script src="ext/iphone-style-checkboxes.js" type="text/javascript"></script>
<link rel="stylesheet" href="ext/iphone-style-checkboxes.css" type="text/css" media="screen" />
<script>
var nice1,nice2;
var body;
var off;
$(window).load(function(){
off = $("#boxscroll").position();
off.top+=2;
off.left+=2;
$("#boxscroll").scroll();
// alert($(window).width());
});
function initScroll() {
var tb = $('#nctouch').prop("checked");
if (nice1) nice1.remove();
nice1 = $("#boxscroll").niceScroll({touchbehavior:tb,cursorcolor:"#0000FF",cursoropacitymax:0.6,cursorwidth:8,horizrailenabled:true});
$("#ncver").html(nice1.version);
$("#boxscroll").scroll(function(e) {
if (!off) return;
var px = $("#boxscroll").scrollLeft() - off.left;
var py = $("#boxscroll").scrollTop() - off.top;
body.style.backgroundPosition=-px+"px "+-py+"px";
$("#infoscroll1").html($("#boxscroll").scrollLeft()+'x'+$("#boxscroll").scrollTop());
});
$("#boxscroll").scroll();
/*
$("#boxscroll2").scroll(function(e) {
var me = $(this);
$("#infoscroll2").html(me.scrollLeft()+'x'+me.scrollTop());
});
*/
/*
nice2.scrollstart(function(info){
console.log(info);
});
*/
/*
nice2.scrollend(function(info){
console.log(info);
});
*/
}
$(document).ready(function() {
body = document.getElementsByTagName("body")[0];
// $('body').niceScroll({cursoropacitymax:0.8,cursorwidth:8});
$('#nctouch').iphoneStyle().change(function(){
initScroll();
});
initScroll();
});
function getScroll(name) {
$(name).scrollTop(Math.floor(Math.random()*3000));
}
function getScroll2D(name) {
$(name).getNiceScroll().doScrollPos(Math.floor(Math.random()*4000),Math.floor(Math.random()*4000),150);
}
</script>
<meta name="viewport" content="user-scalable=no" />
</head>
<body class="bgm">
<div style="height:120px" class="header">
<h2>NICESCROLL - SCROLLING TEST</h2>
<div>TEST PAGE - Nicescroll version: <span id="ncver"></span></div>
<table border="0" cellspacing="0" cellpadding="4"><tr><td>Enable touchbehavior option:</td><td><input type="checkbox" id="nctouch" /></td></tr></table>
</div>
<p> </p>
<div id="boxscroll"><div class="mush"></div></div>
<div id="debug"></div>
<p> </p>
<input type="button" value="GET SCROLL!" onclick='getScroll("#boxscroll")' /> <input type="button" value="GET SCROLL2D!" onclick='getScroll2D("#boxscroll")' />
<p> </p>
<input type="button" value="HIDE ALL!" onclick='$(":nicescroll").getNiceScroll().hide()' /> <input type="button" value="SHOW ALL!" onclick='$(":nicescroll").getNiceScroll().show()' />
</body>
</html>