-
Notifications
You must be signed in to change notification settings - Fork 0
/
slideshow.html
240 lines (175 loc) · 5.54 KB
/
slideshow.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
<!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>jQuery News Slider Demo | Queness</title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery.scrollTo-min.js"></script>
<script>
$(document).ready(function() {
//Speed of the slideshow
var speed = 2500;
//You have to specify width and height in #slider CSS properties
//After that, the following script will set the width and height accordingly
$('#mask-gallery, #gallery li').width($('#slider').width());
$('#gallery').width($('#slider').width() * $('#gallery li').length);
$('#mask-gallery, #gallery li').height($('#slider').height());
$('#mask-excerpt, #excerpt li').height($('#slider').height()/10);
$('#mask-excerpt, #excerpt li').width($('#slider').width());
//just 1/10 of height should be used as height for the message
//Assign a timer, so it will run periodically
var run = setInterval('newsscoller(0)', speed);
$('#gallery li:first, #excerpt li:first').addClass('selected');
/*
//Pause the slidershow with clearInterval
$('#btn-pause').click(function () {
clearInterval(run);
return false;
});
//Continue the slideshow with setInterval
$('#btn-play').click(function () {
run = setInterval('newsscoller(0)', speed);
return false;
});
//Next Slide by calling the function
$('#btn-next').click(function () {
newsscoller(0);
return false;
});
//Previous slide by passing prev=1
$('#btn-prev').click(function () {
newsscoller(1);
return false;
});
*/
//Mouse over, pause it, on mouse out, resume the slider show
$('#slider').hover(
function() {
clearInterval(run);
},
function() {
run = setInterval('newsscoller(0)', speed);
}
);
});
function newsscoller(prev) {
//Get the current selected item (with selected class), if none was found, get the first item
var current_image = $('#gallery li.selected').length ? $('#gallery li.selected') : $('#gallery li:first');
var current_excerpt = $('#excerpt li.selected').length ? $('#excerpt li.selected') : $('#excerpt li:first');
//if prev is set to 1 (previous item)
if (prev) {
//Get previous sibling
var next_image = (current_image.prev().length) ? current_image.prev() : $('#gallery li:last');
var next_excerpt = (current_excerpt.prev().length) ? current_excerpt.prev() : $('#excerpt li:last');
//if prev is set to 0 (next item)
} else {
//Get next sibling
var next_image = (current_image.next().length) ? current_image.next() : $('#gallery li:first');
var next_excerpt = (current_excerpt.next().length) ? current_excerpt.next() : $('#excerpt li:first');
}
//clear the selected class
$('#excerpt li, #gallery li').removeClass('selected');
//reassign the selected class to current items
next_image.addClass('selected');
next_excerpt.addClass('selected');
//Scroll the items
$('#mask-gallery').scrollTo(next_image, 400);
$('#mask-excerpt').scrollTo(next_excerpt, 400);
}
</script>
<style>
#slider {
/* You MUST specify the width and height */
width:225px;
height:300px;
position:relative;
overflow:hidden;
}
#mask-gallery {
overflow:hidden;
}
#gallery {
/* Clear the list style */
list-style:none;
margin:0;
padding:0;
z-index:0;
/* width = total items multiply with #mask gallery width */
width:2700px;
overflow:hidden;
}
#gallery li {
/* float left, so that the items are arrangged horizontally */
float:left;
}
#mask-excerpt {
/* Set the position */
position:absolute;
top:0;
left:0;
z-index:500px;
/* width should be lesser than #slider width */
/*width:100px;*/
overflow:hidden;
}
#excerpt {
/* Opacity setting for different browsers */
filter:alpha(opacity=60);
-moz-opacity:0.6;
-khtml-opacity: 0.6;
opacity: 0.6;
/* Clear the list style */
list-style:none;
margin:0;
padding:0;
/* Set the position */
z-index:10;
position:absolute;
top:0;
left:0;
/* Set the style */
/*width:100px;*/
background-color:#000;
overflow:hidden;
font-family:arial;
font-size:10px;
color:#fff;
}
#excerpt li {
padding:5px;
}
.clear {
clear:both;
}
</style>
</head>
<body>
<div id="debug"></div>
<div id="slider">
<div id="mask-gallery">
<ul id="gallery">
<li><img src="images/Ticker/1.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/2.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/3.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/4.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/5.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/6.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/7.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/8.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/9.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/10.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/11.jpg" width="225" height="300" alt=""/></li>
<li><img src="images/Ticker/12.jpg" width="225" height="300" alt=""/></li>
</ul>
</div>
<div id="mask-excerpt">
<ul id="excerpt">
<li>School bags</li>
<li>Casual bags</li>
<li>Laptop bags</li>
</ul>
</div>
</div>
<div class="clear"></div>
<div style="font-size:10px;color:#888">Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License.</div>
</body>
</html>