forked from vitch/jScrollPane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scroll_to_animate.html
197 lines (187 loc) · 8.83 KB
/
scroll_to_animate.html
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
193
194
195
196
197
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>jScrollPane scrollTo/ scrollBy with animation demo page</title>
<!-- styles specific to demo site -->
<link type="text/css" href="style/demo.css" rel="stylesheet" media="all" />
<!-- styles needed by jScrollPane - include in your own sites -->
<link type="text/css" href="style/jquery.jscrollpane.css" rel="stylesheet" media="all" />
<style type="text/css" id="page-css">
/* Styles specific to this particular page */
.scroll-pane
{
width: 100%;
height: 200px;
overflow: auto;
}
div#forms
{
overflow: hidden;
}
form
{
float: left;
width: 50%;
padding: 0 0 1em;
}
</style>
<!-- latest jQuery direct from google's CDN -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- the mousewheel plugin -->
<script type="text/javascript" src="script/jquery.mousewheel.js"></script>
<!-- the jScrollPane script -->
<script type="text/javascript" src="script/jquery.jscrollpane.min.js"></script>
<!-- scripts specific to this demo site -->
<script type="text/javascript" src="script/demo.js"></script>
<script type="text/javascript" id="sourcecode">
$(function()
{
var pane = $('.scroll-pane');
pane.jScrollPane(
{
showArrows: true,
animateScroll: true
}
);
var api = pane.data('jsp');
$('#but-scroll-to').bind(
'click',
function()
{
// Note, there is also scrollToX and scrollToY methods if you only
// want to scroll in one dimension
api.scrollTo(parseInt($('#toX').val()), parseInt($('#toY').val()));
return false;
}
);
$('#but-scroll-by').bind(
'click',
function()
{
// Note, there is also scrollByX and scrollByY methods if you only
// want to scroll in one dimension
api.scrollBy(parseInt($('#byX').val()), parseInt($('#byY').val()));
return false;
}
);
});
</script>
</head>
<body>
<div id="top-nav">
<img src="image/logo.png" width="196" height="69" alt="jScrollPane">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="index.html#examples">Examples</a></li>
<li><a href="index.html#themes">Themes</a></li>
<li><a href="index.html#usage">How to use</a></li>
<li><a href="faqs.html">FAQs</a></li>
<li><a href="known_issues.html">Known issues</a></li>
<li><a href="index.html#support">Support</a></li>
<li><a href="index.html#download">Download</a></li>
</ul>
</div>
<div id="container">
<h1>jScrollPane - scrollTo/ scrollBy with animation page</h1>
<p>
This example extends the basic <a href="scroll_to.html">scrollTo/ scrollBy</a> demo and passes
<strong><a href="settings.html#animateScroll">animateScroll</a>: true</strong> in the settings.
This means that when you call <a href="api.html#scrollTo">scrollTo</a> or <a href="api.html#scrollBy">
scrollBy</a> the transition to the new state is animated.
</p>
<p>
Note that the <a href="api.html#animate">animate</a> function which is called is a property on the
jScrollPane API method. This means that you are free to overwrite it if you want to implement custom
animation settings for your paricular use case. If you just want to tweak the speed and easing of the
default animation then you can use the <a href="settings.html#animateDuration">animateDuration</a> and
<a href="settings.html#animateEase">animateEase</a> settings properties.
</p>
<div id="forms">
<form>
<fieldset>
<legend>scrollTo functionality</legend>
<label for="toX">To x:</label>
<input type="text" id="toX" name="toX" value="0" />
<label for="toY">To y:</label>
<input type="text" id="toY" name="toY" value="0" />
<input type="submit" id="but-scroll-to" value="Scroll to" />
</fieldset>
</form>
<form>
<fieldset>
<legend>scrollBy functionality</legend>
<label for="byX">By x:</label>
<input type="text" id="byX" name="byX" value="0" />
<label for="byY">By y:</label>
<input type="text" id="byY" name="byY" value="0" />
<input type="submit" id="but-scroll-by" value="Scroll by" />
</fieldset>
</form>
</div>
<div class="scroll-pane">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec in ligula id sem tristique ultrices
eget id neque. Duis enim turpis, tempus at accumsan vitae, lobortis id sapien. Pellentesque nec orci
mi, in pharetra ligula. Nulla facilisi. Nulla facilisi. Mauris convallis venenatis massa, quis
consectetur felis ornare quis. Sed aliquet nunc ac ante molestie ultricies. Nam pulvinar ultricies
bibendum. Vivamus diam leo, faucibus et vehicula eu, molestie sit amet dui. Proin nec orci et elit
semper ultrices. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Sed quis urna mi, ac dignissim mauris. Quisque mollis ornare mauris, sed laoreet diam malesuada
quis. Proin vel elementum ante. Donec hendrerit arcu ac odio tincidunt posuere. Vestibulum nec risus
eu lacus semper viverra.
</p>
<p style="width: 900px;">
Vestibulum dictum consectetur magna eu egestas. Praesent molestie dapibus erat, sit amet sodales
lectus congue ut. Nam adipiscing, tortor ac blandit egestas, lorem ligula posuere ipsum, nec
faucibus nisl enim eu purus. Quisque bibendum diam quis nunc eleifend at molestie libero tincidunt.
Quisque tincidunt sapien a sapien pellentesque consequat. Mauris adipiscing venenatis augue ut
tempor. Donec auctor mattis quam quis aliquam. Nullam ultrices erat in dolor pharetra bibendum.
Suspendisse eget odio ut libero imperdiet rhoncus. Curabitur aliquet, ipsum sit amet aliquet varius,
est urna ullamcorper magna, sed eleifend libero nunc non erat. Vivamus semper turpis ac turpis
volutpat non cursus velit aliquam. Fusce id tortor id sapien porta egestas. Nulla venenatis luctus
libero et suscipit. Sed sed purus risus. Donec auctor, leo nec eleifend vehicula, lacus felis
sollicitudin est, vitae lacinia lectus urna nec libero. Aliquam pellentesque, arcu condimentum
pharetra vestibulum, lectus felis malesuada felis, vel fringilla dolor dui tempus nisi. In hac
habitasse platea dictumst. Ut imperdiet mauris vitae eros varius eget accumsan lectus adipiscing.
</p>
<p>
Quisque et massa leo, sit amet adipiscing nisi. Mauris vel condimentum dolor. Duis quis ullamcorper
eros. Proin metus dui, facilisis id bibendum sed, aliquet non ipsum. Aenean pulvinar risus eu nisi
dictum eleifend. Maecenas mattis dolor eget lectus pretium eget molestie libero auctor. Praesent sit
amet tellus sed nibh convallis semper. Curabitur nisl odio, feugiat non dapibus sed, tincidunt ut
est. Nullam erat velit, suscipit aliquet commodo sit amet, mollis in mauris. Curabitur pharetra
dictum interdum. In posuere pretium ultricies. Curabitur volutpat eros vehicula quam ultrices
varius. Proin volutpat enim a massa tempor ornare. Sed ullamcorper fermentum nisl, ac hendrerit sem
feugiat ac. Donec porttitor ullamcorper quam. Morbi pretium adipiscing quam, quis bibendum diam
congue eget. Sed at lectus at est malesuada iaculis. Sed fermentum quam dui. Donec eget ipsum dolor,
id mollis nisi. Donec fermentum vehicula porta.
</p>
<p>
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero
sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed,
commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros
ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis.
Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna
eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis
luctus, metus
</p>
<p>
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit
amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
</p>
</div>
<h2>Page javascript</h2>
<div id="sourcecode-display">
<p>The contents of this div will be replaced by the javascript added to this page</p>
</div>
<h2>Page CSS</h2>
<div id="css-display">
<p>The contents of this div will be replaced by the CSS added to this page</p>
</div>
</div>
</body>
</html>