-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
315 lines (294 loc) · 12 KB
/
index.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!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>
<title>hSlides jQuery plugin</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="all">
.accordion{
margin:0;
padding:0;
}
.accordion li {
list-style-type: none;
}
.accordion ul {
margin-left: 25px;
padding-left: 0;
}
.accordion ul li {
list-style-type: disc;
}
li {
list-style-type: none;
}
.one{
background:#f00;
}
.two{
background:#0f0;
}
.three{
background:#00f;
}
.four{
background:#ff0;
}
.five{
background:#0ff;
}
.active{
background:#f0f;
}
.accordion li{
cursor:pointer;
}
.accordion .active_click{
cursor:default;
}
</style>
<script src="jquery-1.4.min.js" type="text/javascript"></script>
<script src="jquery.hslides.js" type="text/javascript"></script>
<script src="jquery.hoverintent.js" type="text/javascript"></script>
<script src="jquery.easing.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
enterFunction = function(){
$(this).html('ACTIVE');
}
leaveFunction = function(){
$(this).html('inactive');
}
$('.accordion1').hSlides({
totalWidth: 730,
totalHeight: 140,
minPanelWidth: 77,
maxPanelWidth: 425
});
$('.accordion2').hSlides({
totalWidth: 305,
totalHeight: 200,
minPanelWidth: 27,
maxPanelWidth: 200,
activeClass: 'active',
speed: 1500,
panelSelector: 'li.panel'
});
$('.accordion3').hSlides({
totalWidth: 730,
totalHeight: 140,
minPanelWidth: 77,
maxPanelWidth: 425,
midPanelWidth: 150,
easing: 'easeOutBounce',
sensitivity: 1,
interval: 50,
timeout: 100,
onEnter: enterFunction,
onLeave: leaveFunction
});
$('.accordion4').hSlides({
totalWidth: 730,
totalHeight: 140,
minPanelWidth: 77,
maxPanelWidth: 425,
panelPositioning: 'bottom',
eventHandler: 'hover',
panelSelector: 'span',
activeClass: 'active_click'
});
}
);
</script>
</head>
<body>
<h1>hSlides:</h1>
<pre>
hSlides is an horizontal accordion navigation, sliding the panels around to reveal one of interest.
Sample Configuration:
// this is the minimum configuration needed
$('#accordion').hSlides({
totalWidth: 730,
totalHeight: 140,
minPanelWidth: 87,
maxPanelWidth: 425
});
Config Options:
// Required configuration
totalWidth: Total width of the accordion // default: 0
totalHeight: Total height of the accordion // default: 0
minPanelWidth: Minimum width of the panel (closed) // default: 0
maxPanelWidth: Maximum width of the panel (opened) // default: 0
// Optional configuration
midPanelWidth: Middle width of the panel (centered) // default: 0
speed: Speed for the animation // default: 500
easing: Easing effect for the animation. Other than 'swing' or 'linear' must be provided by plugin // default: 'swing'
sensitivity: Sensitivity threshold (must be 1 or higher) // default: 3
interval: Milliseconds for onMouseOver polling interval // default: 100
timeout: Milliseconds delay before onMouseOut // default: 300
eventHandler: Event to open panels: click or hover. For the hover option requires hoverIntent plugin <http://cherne.net/brian/resources/jquery.hoverIntent.html> // default: 'click'
panelSelector: HTML element storing the panels // default: 'li'
activeClass: CSS class for the active panel // default: none
panelPositioning: Accordion panelPositioning: top -> first panel on the bottom and next on the top, other value -> first panel on the top and next to the bottom // default: 'top'
// Callback funtctions. Inside them, we can refer the panel with $(this).
onEnter: Funtion raised when the panel is activated. // default: none
onLeave: Funtion raised when the panel is deactivated. // default: none
We can override the defaults with:
$.fn.hSlides.defaults.easing = 'easeOutCubic';
</pre>
<h1>hSlides samples:</h1>
<pre>
Standard accordion HTML structure:
<ul class="accordion accordion1">
<li class="one"><h3>Panel 1</h3><p>Text.</p></li>
<li class="two"><h3>Panel 2</h3><p>Text.</p></li>
<li class="three"><h3>Panel 3</h3><p>Text.</p></li>
<li class="four"><h3>Panel 4</h3><p>Text.</p></li>
<li class="five"><h3>Panel 5</h3><p>Text.</p></li>
</ul>
CSS styles:
.accordion, .accordion *{
margin:0;
padding:0;
list-style-type: none;
}
.one{
background:#f00;
}
.two{
background:#0f0;
}
.three{
background:#00f;
}
.four{
background:#ff0;
}
.five{
background:#0ff;
}
.accordion li{
cursor:pointer;
}
.accordion .active_click{
cursor:default;
}
</pre>
<h2>Sample 1:</h2>
<ul>
<li><strong>Minimum configuration</strong></li>
</ul>
<pre>
$('.accordion1').hSlides({
totalWidth: 730,
totalHeight: 140,
minPanelWidth: 87,
maxPanelWidth: 425
});
</pre>
<ul class="accordion accordion1">
<li class="one"><h3>Panel 1</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
<li class="two"><h3>Panel 2</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
<li class="three"><h3>Panel 3</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
<li class="four"><h3>Panel 4</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
<li class="five"><h3>Panel 5</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
</ul>
<h2>Sample 2:</h2>
<ul>
<li><strong>Different sizes</strong></li>
<li><strong>First panel active</strong></li>
<li><strong>Change active style</strong></li>
<li><strong>Slower</strong></li>
<li><strong>With internal list items, so we have a panel class to use as selector and avoid errors</strong></li>
</ul>
<pre>
$('.accordion1').hSlides({
totalWidth: 730,
totalHeight: 140,
minPanelWidth: 87,
maxPanelWidth: 425,
activeClass: 'active',
speed: 1500,
panelSelector: 'li.panel'
});
HTML:
<li class="one active">
CSS:
.active{
background:#f0f;
}
</pre>
<ul class="accordion accordion2">
<li class="one active panel"><h3>Panel 1</h3><p><ul><li>a</li><li>b</li></ul>Donec gravida posuere arcu. </p></li>
<li class="two panel"><h3>Panel 2</h3><p><ul><li>a</li><li>b</li></ul>Donec gravida posuere arcu. </p></li>
<li class="three panel"><h3>Panel 3</h3><p><ul><li>a</li><li>b</li></ul>Donec gravida posuere arcu. </p></li>
<li class="four panel"><h3>Panel 4</h3><p><ul><li>a</li><li>b</li></ul>Donec gravida posuere arcu. </p></li>
<li class="five panel"><h3>Panel 5</h3><p><ul><li>a</li><li>b</li></ul>Donec gravida posuere arcu. </p></li>
</ul>
<h2>Sample 3:</h2>
<ul>
<li><strong>Centered panels</strong></li>
<li><strong>Bouncing easing</strong></li>
<li><strong>Change hoverIntent configuration (same variable names)</strong></li>
<li><strong>Calling callback functions</strong></li>
</ul>
<pre>
enterFunction = function(){
$(this).html('ACTIVE');
}
leaveFunction = function(){
$(this).html('inactive');
}
$('.accordion1').hSlides({
totalWidth: 730,
totalHeight: 140,
minPanelWidth: 87,
maxPanelWidth: 425,
midPanelWidth: 150,
easing: 'easeOutBounce', // provided by plugin http://gsgd.co.uk/sandbox/jquery/easing/
sensitivity: 1,
interval: 50,
timeout: 100,
onEnter: enterFunction,
onLeave: leaveFunction
});
</pre>
<ul class="accordion accordion3">
<li class="one"><h3>Panel 1</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
<li class="two"><h3>Panel 2</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
<li class="three"><h3>Panel 3</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
<li class="four"><h3>Panel 4</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
<li class="five"><h3>Panel 5</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></li>
</ul>
<h2>Sample 4:</h2>
<ul>
<li><strong>Invert panel positioning (top to bottom)</strong></li>
<li><strong>Hover to active panel</strong></li>
<li><strong>second panel active</strong></li>
<li><strong>Change structure to div/span (instead of default ul/li)</strong></li>
</ul>
<pre>
$('.accordion1').hSlides({
totalWidth: 730,
totalHeight: 140,
minPanelWidth: 87,
maxPanelWidth: 425,
panelPositioning: 'bottom',
eventHandler: 'hover',
panelSelector: 'span',
activeClass: 'active'
});
HTML:
<div class="accordion accordion4">
<span class="one active_click"><h3>Panel 1</h3><p>Text.</p></span>
<span class="two"><h3>Panel 2</h3>...
......
</pre>
<div class="accordion accordion4">
<span class="one"><h3>Panel 1</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></span>
<span class="two active_click"><h3>Panel 2</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></span>
<span class="three"><h3>Panel 3</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></span>
<span class="four"><h3>Panel 4</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></span>
<span class="five"><h3>Panel 5</h3><p>Donec gravida posuere arcu. Nulla facilisi. Phasellus imperdiet. Vestibulum at metus. Integer euismod. Nullam placerat rhoncus sapien. Ut euismod. Praesent libero. Morbi pellentesque libero sit amet ante.</p></span>
</div>
</body>
</html>