1 |
85ad3d82
|
Assos Assos
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
jQuery(document).ready(function($) {
|
14 |
|
|
$('.slideshow').cycle({
|
15 |
|
|
fx: 'fade' , timeout: 8000, delay: 2000});
|
16 |
|
|
});
|
17 |
|
|
|
18 |
|
|
;(function($) {
|
19 |
|
|
|
20 |
|
|
var ver = '2.86';
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
if ($.support == undefined) {
|
24 |
|
|
$.support = {
|
25 |
|
|
opacity: !($.browser.msie)
|
26 |
|
|
};
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
function debug(s) {
|
30 |
|
|
if ($.fn.cycle.debug)
|
31 |
|
|
log(s);
|
32 |
|
|
}
|
33 |
|
|
function log() {
|
34 |
|
|
if (window.console && window.console.log)
|
35 |
|
|
window.console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
|
36 |
|
|
};
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
$.fn.cycle = function(options, arg2) {
|
49 |
|
|
var o = { s: this.selector, c: this.context };
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
if (this.length === 0 && options != 'stop') {
|
53 |
|
|
if (!$.isReady && o.s) {
|
54 |
|
|
log('DOM not ready, queuing slideshow');
|
55 |
|
|
$(function() {
|
56 |
|
|
$(o.s,o.c).cycle(options,arg2);
|
57 |
|
|
});
|
58 |
|
|
return this;
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
|
62 |
|
|
return this;
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
return this.each(function() {
|
67 |
|
|
var opts = handleArguments(this, options, arg2);
|
68 |
|
|
if (opts === false)
|
69 |
|
|
return;
|
70 |
|
|
|
71 |
|
|
opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
if (this.cycleTimeout)
|
75 |
|
|
clearTimeout(this.cycleTimeout);
|
76 |
|
|
this.cycleTimeout = this.cyclePause = 0;
|
77 |
|
|
|
78 |
|
|
var $cont = $(this);
|
79 |
|
|
var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
|
80 |
|
|
var els = $slides.get();
|
81 |
|
|
if (els.length < 2) {
|
82 |
|
|
log('terminating; too few slides: ' + els.length);
|
83 |
|
|
return;
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
var opts2 = buildOptions($cont, $slides, els, opts, o);
|
87 |
|
|
if (opts2 === false)
|
88 |
|
|
return;
|
89 |
|
|
|
90 |
|
|
var startTime = opts2.continuous ? 10 : getTimeout(opts2.currSlide, opts2.nextSlide, opts2, !opts2.rev);
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
if (startTime) {
|
94 |
|
|
startTime += (opts2.delay || 0);
|
95 |
|
|
if (startTime < 10)
|
96 |
|
|
startTime = 10;
|
97 |
|
|
debug('first timeout: ' + startTime);
|
98 |
|
|
this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts2.rev)}, startTime);
|
99 |
|
|
}
|
100 |
|
|
});
|
101 |
|
|
};
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
function handleArguments(cont, options, arg2) {
|
105 |
|
|
if (cont.cycleStop == undefined)
|
106 |
|
|
cont.cycleStop = 0;
|
107 |
|
|
if (options === undefined || options === null)
|
108 |
|
|
options = {};
|
109 |
|
|
if (options.constructor == String) {
|
110 |
|
|
switch(options) {
|
111 |
|
|
case 'destroy':
|
112 |
|
|
case 'stop':
|
113 |
|
|
var opts = $(cont).data('cycle.opts');
|
114 |
|
|
if (!opts)
|
115 |
|
|
return false;
|
116 |
|
|
cont.cycleStop++;
|
117 |
|
|
if (cont.cycleTimeout)
|
118 |
|
|
clearTimeout(cont.cycleTimeout);
|
119 |
|
|
cont.cycleTimeout = 0;
|
120 |
|
|
$(cont).removeData('cycle.opts');
|
121 |
|
|
if (options == 'destroy')
|
122 |
|
|
destroy(opts);
|
123 |
|
|
return false;
|
124 |
|
|
case 'toggle':
|
125 |
|
|
cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
|
126 |
|
|
checkInstantResume(cont.cyclePause, arg2, cont);
|
127 |
|
|
return false;
|
128 |
|
|
case 'pause':
|
129 |
|
|
cont.cyclePause = 1;
|
130 |
|
|
return false;
|
131 |
|
|
case 'resume':
|
132 |
|
|
cont.cyclePause = 0;
|
133 |
|
|
checkInstantResume(false, arg2, cont);
|
134 |
|
|
return false;
|
135 |
|
|
case 'prev':
|
136 |
|
|
case 'next':
|
137 |
|
|
var opts = $(cont).data('cycle.opts');
|
138 |
|
|
if (!opts) {
|
139 |
|
|
log('options not found, "prev/next" ignored');
|
140 |
|
|
return false;
|
141 |
|
|
}
|
142 |
|
|
$.fn.cycle[options](opts);
|
143 |
|
|
return false;
|
144 |
|
|
default:
|
145 |
|
|
options = { fx: options };
|
146 |
|
|
};
|
147 |
|
|
return options;
|
148 |
|
|
}
|
149 |
|
|
else if (options.constructor == Number) {
|
150 |
|
|
|
151 |
|
|
var num = options;
|
152 |
|
|
options = $(cont).data('cycle.opts');
|
153 |
|
|
if (!options) {
|
154 |
|
|
log('options not found, can not advance slide');
|
155 |
|
|
return false;
|
156 |
|
|
}
|
157 |
|
|
if (num < 0 || num >= options.elements.length) {
|
158 |
|
|
log('invalid slide index: ' + num);
|
159 |
|
|
return false;
|
160 |
|
|
}
|
161 |
|
|
options.nextSlide = num;
|
162 |
|
|
if (cont.cycleTimeout) {
|
163 |
|
|
clearTimeout(cont.cycleTimeout);
|
164 |
|
|
cont.cycleTimeout = 0;
|
165 |
|
|
}
|
166 |
|
|
if (typeof arg2 == 'string')
|
167 |
|
|
options.oneTimeFx = arg2;
|
168 |
|
|
go(options.elements, options, 1, num >= options.currSlide);
|
169 |
|
|
return false;
|
170 |
|
|
}
|
171 |
|
|
return options;
|
172 |
|
|
|
173 |
|
|
function checkInstantResume(isPaused, arg2, cont) {
|
174 |
|
|
if (!isPaused && arg2 === true) {
|
175 |
|
|
var options = $(cont).data('cycle.opts');
|
176 |
|
|
if (!options) {
|
177 |
|
|
log('options not found, can not resume');
|
178 |
|
|
return false;
|
179 |
|
|
}
|
180 |
|
|
if (cont.cycleTimeout) {
|
181 |
|
|
clearTimeout(cont.cycleTimeout);
|
182 |
|
|
cont.cycleTimeout = 0;
|
183 |
|
|
}
|
184 |
|
|
go(options.elements, options, 1, 1);
|
185 |
|
|
}
|
186 |
|
|
}
|
187 |
|
|
};
|
188 |
|
|
|
189 |
|
|
function removeFilter(el, opts) {
|
190 |
|
|
if (!$.support.opacity && opts.cleartype && el.style.filter) {
|
191 |
|
|
try { el.style.removeAttribute('filter'); }
|
192 |
|
|
catch(smother) {}
|
193 |
|
|
}
|
194 |
|
|
};
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
function destroy(opts) {
|
198 |
|
|
if (opts.next)
|
199 |
|
|
$(opts.next).unbind(opts.prevNextEvent);
|
200 |
|
|
if (opts.prev)
|
201 |
|
|
$(opts.prev).unbind(opts.prevNextEvent);
|
202 |
|
|
|
203 |
|
|
if (opts.pager || opts.pagerAnchorBuilder)
|
204 |
|
|
$.each(opts.pagerAnchors || [], function() {
|
205 |
|
|
this.unbind().remove();
|
206 |
|
|
});
|
207 |
|
|
opts.pagerAnchors = null;
|
208 |
|
|
if (opts.destroy)
|
209 |
|
|
opts.destroy(opts);
|
210 |
|
|
};
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
function buildOptions($cont, $slides, els, options, o) {
|
214 |
|
|
|
215 |
|
|
var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
|
216 |
|
|
if (opts.autostop)
|
217 |
|
|
opts.countdown = opts.autostopCount || els.length;
|
218 |
|
|
|
219 |
|
|
var cont = $cont[0];
|
220 |
|
|
$cont.data('cycle.opts', opts);
|
221 |
|
|
opts.$cont = $cont;
|
222 |
|
|
opts.stopCount = cont.cycleStop;
|
223 |
|
|
opts.elements = els;
|
224 |
|
|
opts.before = opts.before ? [opts.before] : [];
|
225 |
|
|
opts.after = opts.after ? [opts.after] : [];
|
226 |
|
|
opts.after.unshift(function(){ opts.busy=0; });
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
if (!$.support.opacity && opts.cleartype)
|
230 |
|
|
opts.after.push(function() { removeFilter(this, opts); });
|
231 |
|
|
if (opts.continuous)
|
232 |
|
|
opts.after.push(function() { go(els,opts,0,!opts.rev); });
|
233 |
|
|
|
234 |
|
|
saveOriginalOpts(opts);
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
|
238 |
|
|
clearTypeFix($slides);
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
if ($cont.css('position') == 'static')
|
242 |
|
|
$cont.css('position', 'relative');
|
243 |
|
|
if (opts.width)
|
244 |
|
|
$cont.width(opts.width);
|
245 |
|
|
if (opts.height && opts.height != 'auto')
|
246 |
|
|
$cont.height(opts.height);
|
247 |
|
|
|
248 |
|
|
if (opts.startingSlide)
|
249 |
|
|
opts.startingSlide = parseInt(opts.startingSlide);
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
if (opts.random) {
|
253 |
|
|
opts.randomMap = [];
|
254 |
|
|
for (var i = 0; i < els.length; i++)
|
255 |
|
|
opts.randomMap.push(i);
|
256 |
|
|
opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
|
257 |
|
|
opts.randomIndex = 1;
|
258 |
|
|
opts.startingSlide = opts.randomMap[1];
|
259 |
|
|
}
|
260 |
|
|
else if (opts.startingSlide >= els.length)
|
261 |
|
|
opts.startingSlide = 0;
|
262 |
|
|
opts.currSlide = opts.startingSlide || 0;
|
263 |
|
|
var first = opts.startingSlide;
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
|
267 |
|
|
var z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
|
268 |
|
|
$(this).css('z-index', z)
|
269 |
|
|
});
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
$(els[first]).css('opacity',1).show();
|
273 |
|
|
removeFilter(els[first], opts);
|
274 |
|
|
|
275 |
|
|
|
276 |
|
|
if (opts.fit && opts.width)
|
277 |
|
|
$slides.width(opts.width);
|
278 |
|
|
if (opts.fit && opts.height && opts.height != 'auto')
|
279 |
|
|
$slides.height(opts.height);
|
280 |
|
|
|
281 |
|
|
|
282 |
|
|
var reshape = opts.containerResize && !$cont.innerHeight();
|
283 |
|
|
if (reshape) {
|
284 |
|
|
var maxw = 0, maxh = 0;
|
285 |
|
|
for(var j=0; j < els.length; j++) {
|
286 |
|
|
var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
|
287 |
|
|
if (!w) w = e.offsetWidth || e.width || $e.attr('width')
|
288 |
|
|
if (!h) h = e.offsetHeight || e.height || $e.attr('height');
|
289 |
|
|
maxw = w > maxw ? w : maxw;
|
290 |
|
|
maxh = h > maxh ? h : maxh;
|
291 |
|
|
}
|
292 |
|
|
if (maxw > 0 && maxh > 0)
|
293 |
|
|
$cont.css({width:maxw+'px',height:maxh+'px'});
|
294 |
|
|
}
|
295 |
|
|
|
296 |
|
|
if (opts.pause)
|
297 |
|
|
$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});
|
298 |
|
|
|
299 |
|
|
if (supportMultiTransitions(opts) === false)
|
300 |
|
|
return false;
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
var requeue = false;
|
305 |
|
|
options.requeueAttempts = options.requeueAttempts || 0;
|
306 |
|
|
$slides.each(function() {
|
307 |
|
|
|
308 |
|
|
var $el = $(this);
|
309 |
|
|
this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
|
310 |
|
|
this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);
|
311 |
|
|
|
312 |
|
|
if ( $el.is('img') ) {
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
|
317 |
|
|
var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
|
318 |
|
|
var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
|
319 |
|
|
var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
|
320 |
|
|
|
321 |
|
|
if (loadingIE || loadingFF || loadingOp || loadingOther) {
|
322 |
|
|
if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) {
|
323 |
|
|
log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
|
324 |
|
|
setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout);
|
325 |
|
|
requeue = true;
|
326 |
|
|
return false;
|
327 |
|
|
}
|
328 |
|
|
else {
|
329 |
|
|
log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
|
330 |
|
|
}
|
331 |
|
|
}
|
332 |
|
|
}
|
333 |
|
|
return true;
|
334 |
|
|
});
|
335 |
|
|
|
336 |
|
|
if (requeue)
|
337 |
|
|
return false;
|
338 |
|
|
|
339 |
|
|
opts.cssBefore = opts.cssBefore || {};
|
340 |
|
|
opts.animIn = opts.animIn || {};
|
341 |
|
|
opts.animOut = opts.animOut || {};
|
342 |
|
|
|
343 |
|
|
$slides.not(':eq('+first+')').css(opts.cssBefore);
|
344 |
|
|
if (opts.cssFirst)
|
345 |
|
|
$($slides[first]).css(opts.cssFirst);
|
346 |
|
|
|
347 |
|
|
if (opts.timeout) {
|
348 |
|
|
opts.timeout = parseInt(opts.timeout);
|
349 |
|
|
|
350 |
|
|
if (opts.speed.constructor == String)
|
351 |
|
|
opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed);
|
352 |
|
|
if (!opts.sync)
|
353 |
|
|
opts.speed = opts.speed / 2;
|
354 |
|
|
|
355 |
|
|
var buffer = opts.fx == 'shuffle' ? 500 : 250;
|
356 |
|
|
while((opts.timeout - opts.speed) < buffer)
|
357 |
|
|
opts.timeout += opts.speed;
|
358 |
|
|
}
|
359 |
|
|
if (opts.easing)
|
360 |
|
|
opts.easeIn = opts.easeOut = opts.easing;
|
361 |
|
|
if (!opts.speedIn)
|
362 |
|
|
opts.speedIn = opts.speed;
|
363 |
|
|
if (!opts.speedOut)
|
364 |
|
|
opts.speedOut = opts.speed;
|
365 |
|
|
|
366 |
|
|
opts.slideCount = els.length;
|
367 |
|
|
opts.currSlide = opts.lastSlide = first;
|
368 |
|
|
if (opts.random) {
|
369 |
|
|
if (++opts.randomIndex == els.length)
|
370 |
|
|
opts.randomIndex = 0;
|
371 |
|
|
opts.nextSlide = opts.randomMap[opts.randomIndex];
|
372 |
|
|
}
|
373 |
|
|
else
|
374 |
|
|
opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
if (!opts.multiFx) {
|
378 |
|
|
var init = $.fn.cycle.transitions[opts.fx];
|
379 |
|
|
if ($.isFunction(init))
|
380 |
|
|
init($cont, $slides, opts);
|
381 |
|
|
else if (opts.fx != 'custom' && !opts.multiFx) {
|
382 |
|
|
log('unknown transition: ' + opts.fx,'; slideshow terminating');
|
383 |
|
|
return false;
|
384 |
|
|
}
|
385 |
|
|
}
|
386 |
|
|
|
387 |
|
|
|
388 |
|
|
var e0 = $slides[first];
|
389 |
|
|
if (opts.before.length)
|
390 |
|
|
opts.before[0].apply(e0, [e0, e0, opts, true]);
|
391 |
|
|
if (opts.after.length > 1)
|
392 |
|
|
opts.after[1].apply(e0, [e0, e0, opts, true]);
|
393 |
|
|
|
394 |
|
|
if (opts.next)
|
395 |
|
|
$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1)});
|
396 |
|
|
if (opts.prev)
|
397 |
|
|
$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1)});
|
398 |
|
|
if (opts.pager || opts.pagerAnchorBuilder)
|
399 |
|
|
buildPager(els,opts);
|
400 |
|
|
|
401 |
|
|
exposeAddSlide(opts, els);
|
402 |
|
|
|
403 |
|
|
return opts;
|
404 |
|
|
};
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
function saveOriginalOpts(opts) {
|
408 |
|
|
opts.original = { before: [], after: [] };
|
409 |
|
|
opts.original.cssBefore = $.extend({}, opts.cssBefore);
|
410 |
|
|
opts.original.cssAfter = $.extend({}, opts.cssAfter);
|
411 |
|
|
opts.original.animIn = $.extend({}, opts.animIn);
|
412 |
|
|
opts.original.animOut = $.extend({}, opts.animOut);
|
413 |
|
|
$.each(opts.before, function() { opts.original.before.push(this); });
|
414 |
|
|
$.each(opts.after, function() { opts.original.after.push(this); });
|
415 |
|
|
};
|
416 |
|
|
|
417 |
|
|
function supportMultiTransitions(opts) {
|
418 |
|
|
var i, tx, txs = $.fn.cycle.transitions;
|
419 |
|
|
|
420 |
|
|
if (opts.fx.indexOf(',') > 0) {
|
421 |
|
|
opts.multiFx = true;
|
422 |
|
|
opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
|
423 |
|
|
|
424 |
|
|
for (i=0; i < opts.fxs.length; i++) {
|
425 |
|
|
var fx = opts.fxs[i];
|
426 |
|
|
tx = txs[fx];
|
427 |
|
|
if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
|
428 |
|
|
log('discarding unknown transition: ',fx);
|
429 |
|
|
opts.fxs.splice(i,1);
|
430 |
|
|
i--;
|
431 |
|
|
}
|
432 |
|
|
}
|
433 |
|
|
|
434 |
|
|
if (!opts.fxs.length) {
|
435 |
|
|
log('No valid transitions named; slideshow terminating.');
|
436 |
|
|
return false;
|
437 |
|
|
}
|
438 |
|
|
}
|
439 |
|
|
else if (opts.fx == 'all') {
|
440 |
|
|
opts.multiFx = true;
|
441 |
|
|
opts.fxs = [];
|
442 |
|
|
for (p in txs) {
|
443 |
|
|
tx = txs[p];
|
444 |
|
|
if (txs.hasOwnProperty(p) && $.isFunction(tx))
|
445 |
|
|
opts.fxs.push(p);
|
446 |
|
|
}
|
447 |
|
|
}
|
448 |
|
|
if (opts.multiFx && opts.randomizeEffects) {
|
449 |
|
|
|
450 |
|
|
var r1 = Math.floor(Math.random() * 20) + 30;
|
451 |
|
|
for (i = 0; i < r1; i++) {
|
452 |
|
|
var r2 = Math.floor(Math.random() * opts.fxs.length);
|
453 |
|
|
opts.fxs.push(opts.fxs.splice(r2,1)[0]);
|
454 |
|
|
}
|
455 |
|
|
debug('randomized fx sequence: ',opts.fxs);
|
456 |
|
|
}
|
457 |
|
|
return true;
|
458 |
|
|
};
|
459 |
|
|
|
460 |
|
|
|
461 |
|
|
function exposeAddSlide(opts, els) {
|
462 |
|
|
opts.addSlide = function(newSlide, prepend) {
|
463 |
|
|
var $s = $(newSlide), s = $s[0];
|
464 |
|
|
if (!opts.autostopCount)
|
465 |
|
|
opts.countdown++;
|
466 |
|
|
els[prepend?'unshift':'push'](s);
|
467 |
|
|
if (opts.els)
|
468 |
|
|
opts.els[prepend?'unshift':'push'](s);
|
469 |
|
|
opts.slideCount = els.length;
|
470 |
|
|
|
471 |
|
|
$s.css('position','absolute');
|
472 |
|
|
$s[prepend?'prependTo':'appendTo'](opts.$cont);
|
473 |
|
|
|
474 |
|
|
if (prepend) {
|
475 |
|
|
opts.currSlide++;
|
476 |
|
|
opts.nextSlide++;
|
477 |
|
|
}
|
478 |
|
|
|
479 |
|
|
if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
|
480 |
|
|
clearTypeFix($s);
|
481 |
|
|
|
482 |
|
|
if (opts.fit && opts.width)
|
483 |
|
|
$s.width(opts.width);
|
484 |
|
|
if (opts.fit && opts.height && opts.height != 'auto')
|
485 |
|
|
$slides.height(opts.height);
|
486 |
|
|
s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
|
487 |
|
|
s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
|
488 |
|
|
|
489 |
|
|
$s.css(opts.cssBefore);
|
490 |
|
|
|
491 |
|
|
if (opts.pager || opts.pagerAnchorBuilder)
|
492 |
|
|
$.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
|
493 |
|
|
|
494 |
|
|
if ($.isFunction(opts.onAddSlide))
|
495 |
|
|
opts.onAddSlide($s);
|
496 |
|
|
else
|
497 |
|
|
$s.hide();
|
498 |
|
|
};
|
499 |
|
|
}
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
$.fn.cycle.resetState = function(opts, fx) {
|
503 |
|
|
fx = fx || opts.fx;
|
504 |
|
|
opts.before = []; opts.after = [];
|
505 |
|
|
opts.cssBefore = $.extend({}, opts.original.cssBefore);
|
506 |
|
|
opts.cssAfter = $.extend({}, opts.original.cssAfter);
|
507 |
|
|
opts.animIn = $.extend({}, opts.original.animIn);
|
508 |
|
|
opts.animOut = $.extend({}, opts.original.animOut);
|
509 |
|
|
opts.fxFn = null;
|
510 |
|
|
$.each(opts.original.before, function() { opts.before.push(this); });
|
511 |
|
|
$.each(opts.original.after, function() { opts.after.push(this); });
|
512 |
|
|
|
513 |
|
|
|
514 |
|
|
var init = $.fn.cycle.transitions[fx];
|
515 |
|
|
if ($.isFunction(init))
|
516 |
|
|
init(opts.$cont, $(opts.elements), opts);
|
517 |
|
|
};
|
518 |
|
|
|
519 |
|
|
|
520 |
|
|
function go(els, opts, manual, fwd) {
|
521 |
|
|
|
522 |
|
|
if (manual && opts.busy && opts.manualTrump) {
|
523 |
|
|
|
524 |
|
|
debug('manualTrump in go(), stopping active transition');
|
525 |
|
|
$(els).stop(true,true);
|
526 |
|
|
opts.busy = false;
|
527 |
|
|
}
|
528 |
|
|
|
529 |
|
|
if (opts.busy) {
|
530 |
|
|
debug('transition active, ignoring new tx request');
|
531 |
|
|
return;
|
532 |
|
|
}
|
533 |
|
|
|
534 |
|
|
var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
|
535 |
|
|
|
536 |
|
|
|
537 |
|
|
if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
|
538 |
|
|
return;
|
539 |
|
|
|
540 |
|
|
|
541 |
|
|
if (!manual && !p.cyclePause &&
|
542 |
|
|
((opts.autostop && (--opts.countdown <= 0)) ||
|
543 |
|
|
(opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
|
544 |
|
|
if (opts.end)
|
545 |
|
|
opts.end(opts);
|
546 |
|
|
return;
|
547 |
|
|
}
|
548 |
|
|
|
549 |
|
|
|
550 |
|
|
var changed = false;
|
551 |
|
|
if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
|
552 |
|
|
changed = true;
|
553 |
|
|
var fx = opts.fx;
|
554 |
|
|
|
555 |
|
|
curr.cycleH = curr.cycleH || $(curr).height();
|
556 |
|
|
curr.cycleW = curr.cycleW || $(curr).width();
|
557 |
|
|
next.cycleH = next.cycleH || $(next).height();
|
558 |
|
|
next.cycleW = next.cycleW || $(next).width();
|
559 |
|
|
|
560 |
|
|
|
561 |
|
|
if (opts.multiFx) {
|
562 |
|
|
if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length)
|
563 |
|
|
opts.lastFx = 0;
|
564 |
|
|
fx = opts.fxs[opts.lastFx];
|
565 |
|
|
opts.currFx = fx;
|
566 |
|
|
}
|
567 |
|
|
|
568 |
|
|
|
569 |
|
|
if (opts.oneTimeFx) {
|
570 |
|
|
fx = opts.oneTimeFx;
|
571 |
|
|
opts.oneTimeFx = null;
|
572 |
|
|
}
|
573 |
|
|
|
574 |
|
|
$.fn.cycle.resetState(opts, fx);
|
575 |
|
|
|
576 |
|
|
|
577 |
|
|
if (opts.before.length)
|
578 |
|
|
$.each(opts.before, function(i,o) {
|
579 |
|
|
if (p.cycleStop != opts.stopCount) return;
|
580 |
|
|
o.apply(next, [curr, next, opts, fwd]);
|
581 |
|
|
});
|
582 |
|
|
|
583 |
|
|
|
584 |
|
|
var after = function() {
|
585 |
|
|
$.each(opts.after, function(i,o) {
|
586 |
|
|
if (p.cycleStop != opts.stopCount) return;
|
587 |
|
|
o.apply(next, [curr, next, opts, fwd]);
|
588 |
|
|
});
|
589 |
|
|
};
|
590 |
|
|
|
591 |
|
|
debug('tx firing; currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
|
592 |
|
|
|
593 |
|
|
|
594 |
|
|
opts.busy = 1;
|
595 |
|
|
if (opts.fxFn)
|
596 |
|
|
opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
|
597 |
|
|
else if ($.isFunction($.fn.cycle[opts.fx]))
|
598 |
|
|
$.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
|
599 |
|
|
else
|
600 |
|
|
$.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
|
601 |
|
|
}
|
602 |
|
|
|
603 |
|
|
if (changed || opts.nextSlide == opts.currSlide) {
|
604 |
|
|
|
605 |
|
|
opts.lastSlide = opts.currSlide;
|
606 |
|
|
if (opts.random) {
|
607 |
|
|
opts.currSlide = opts.nextSlide;
|
608 |
|
|
if (++opts.randomIndex == els.length)
|
609 |
|
|
opts.randomIndex = 0;
|
610 |
|
|
opts.nextSlide = opts.randomMap[opts.randomIndex];
|
611 |
|
|
if (opts.nextSlide == opts.currSlide)
|
612 |
|
|
opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
|
613 |
|
|
}
|
614 |
|
|
else {
|
615 |
|
|
var roll = (opts.nextSlide + 1) == els.length;
|
616 |
|
|
opts.nextSlide = roll ? 0 : opts.nextSlide+1;
|
617 |
|
|
opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
|
618 |
|
|
}
|
619 |
|
|
}
|
620 |
|
|
if (changed && opts.pager)
|
621 |
|
|
opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
|
622 |
|
|
|
623 |
|
|
|
624 |
|
|
var ms = 0;
|
625 |
|
|
if (opts.timeout && !opts.continuous)
|
626 |
|
|
ms = getTimeout(curr, next, opts, fwd);
|
627 |
|
|
else if (opts.continuous && p.cyclePause)
|
628 |
|
|
ms = 10;
|
629 |
|
|
if (ms > 0)
|
630 |
|
|
p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.rev) }, ms);
|
631 |
|
|
};
|
632 |
|
|
|
633 |
|
|
|
634 |
|
|
$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
|
635 |
|
|
$(pager).each(function() {
|
636 |
|
|
$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
|
637 |
|
|
});
|
638 |
|
|
};
|
639 |
|
|
|
640 |
|
|
|
641 |
|
|
function getTimeout(curr, next, opts, fwd) {
|
642 |
|
|
if (opts.timeoutFn) {
|
643 |
|
|
|
644 |
|
|
var t = opts.timeoutFn(curr,next,opts,fwd);
|
645 |
|
|
while ((t - opts.speed) < 250)
|
646 |
|
|
t += opts.speed;
|
647 |
|
|
debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
|
648 |
|
|
if (t !== false)
|
649 |
|
|
return t;
|
650 |
|
|
}
|
651 |
|
|
return opts.timeout;
|
652 |
|
|
};
|
653 |
|
|
|
654 |
|
|
|
655 |
|
|
$.fn.cycle.next = function(opts) { advance(opts, opts.rev?-1:1); };
|
656 |
|
|
$.fn.cycle.prev = function(opts) { advance(opts, opts.rev?1:-1);};
|
657 |
|
|
|
658 |
|
|
|
659 |
|
|
function advance(opts, val) {
|
660 |
|
|
var els = opts.elements;
|
661 |
|
|
var p = opts.$cont[0], timeout = p.cycleTimeout;
|
662 |
|
|
if (timeout) {
|
663 |
|
|
clearTimeout(timeout);
|
664 |
|
|
p.cycleTimeout = 0;
|
665 |
|
|
}
|
666 |
|
|
if (opts.random && val < 0) {
|
667 |
|
|
|
668 |
|
|
opts.randomIndex--;
|
669 |
|
|
if (--opts.randomIndex == -2)
|
670 |
|
|
opts.randomIndex = els.length-2;
|
671 |
|
|
else if (opts.randomIndex == -1)
|
672 |
|
|
opts.randomIndex = els.length-1;
|
673 |
|
|
opts.nextSlide = opts.randomMap[opts.randomIndex];
|
674 |
|
|
}
|
675 |
|
|
else if (opts.random) {
|
676 |
|
|
opts.nextSlide = opts.randomMap[opts.randomIndex];
|
677 |
|
|
}
|
678 |
|
|
else {
|
679 |
|
|
opts.nextSlide = opts.currSlide + val;
|
680 |
|
|
if (opts.nextSlide < 0) {
|
681 |
|
|
if (opts.nowrap) return false;
|
682 |
|
|
opts.nextSlide = els.length - 1;
|
683 |
|
|
}
|
684 |
|
|
else if (opts.nextSlide >= els.length) {
|
685 |
|
|
if (opts.nowrap) return false;
|
686 |
|
|
opts.nextSlide = 0;
|
687 |
|
|
}
|
688 |
|
|
}
|
689 |
|
|
|
690 |
|
|
var cb = opts.onPrevNextEvent || opts.prevNextClick;
|
691 |
|
|
if ($.isFunction(cb))
|
692 |
|
|
cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
|
693 |
|
|
go(els, opts, 1, val>=0);
|
694 |
|
|
return false;
|
695 |
|
|
};
|
696 |
|
|
|
697 |
|
|
function buildPager(els, opts) {
|
698 |
|
|
var $p = $(opts.pager);
|
699 |
|
|
$.each(els, function(i,o) {
|
700 |
|
|
$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
|
701 |
|
|
});
|
702 |
|
|
opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
|
703 |
|
|
};
|
704 |
|
|
|
705 |
|
|
$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
|
706 |
|
|
var a;
|
707 |
|
|
if ($.isFunction(opts.pagerAnchorBuilder)) {
|
708 |
|
|
a = opts.pagerAnchorBuilder(i,el);
|
709 |
|
|
debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
|
710 |
|
|
}
|
711 |
|
|
else
|
712 |
|
|
a = '<a href="#">'+(i+1)+'</a>';
|
713 |
|
|
|
714 |
|
|
if (!a)
|
715 |
|
|
return;
|
716 |
|
|
var $a = $(a);
|
717 |
|
|
|
718 |
|
|
if ($a.parents('body').length === 0) {
|
719 |
|
|
var arr = [];
|
720 |
|
|
if ($p.length > 1) {
|
721 |
|
|
$p.each(function() {
|
722 |
|
|
var $clone = $a.clone(true);
|
723 |
|
|
$(this).append($clone);
|
724 |
|
|
arr.push($clone[0]);
|
725 |
|
|
});
|
726 |
|
|
$a = $(arr);
|
727 |
|
|
}
|
728 |
|
|
else {
|
729 |
|
|
$a.appendTo($p);
|
730 |
|
|
}
|
731 |
|
|
}
|
732 |
|
|
|
733 |
|
|
opts.pagerAnchors = opts.pagerAnchors || [];
|
734 |
|
|
opts.pagerAnchors.push($a);
|
735 |
|
|
$a.bind(opts.pagerEvent, function(e) {
|
736 |
|
|
e.preventDefault();
|
737 |
|
|
opts.nextSlide = i;
|
738 |
|
|
var p = opts.$cont[0], timeout = p.cycleTimeout;
|
739 |
|
|
if (timeout) {
|
740 |
|
|
clearTimeout(timeout);
|
741 |
|
|
p.cycleTimeout = 0;
|
742 |
|
|
}
|
743 |
|
|
var cb = opts.onPagerEvent || opts.pagerClick;
|
744 |
|
|
if ($.isFunction(cb))
|
745 |
|
|
cb(opts.nextSlide, els[opts.nextSlide]);
|
746 |
|
|
go(els,opts,1,opts.currSlide < i);
|
747 |
|
|
|
748 |
|
|
});
|
749 |
|
|
|
750 |
|
|
if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
|
751 |
|
|
$a.bind('click.cycle', function(){return false;});
|
752 |
|
|
|
753 |
|
|
if (opts.pauseOnPagerHover)
|
754 |
|
|
$a.hover(function() { opts.$cont[0].cyclePause++; }, function() { opts.$cont[0].cyclePause--; } );
|
755 |
|
|
};
|
756 |
|
|
|
757 |
|
|
|
758 |
|
|
$.fn.cycle.hopsFromLast = function(opts, fwd) {
|
759 |
|
|
var hops, l = opts.lastSlide, c = opts.currSlide;
|
760 |
|
|
if (fwd)
|
761 |
|
|
hops = c > l ? c - l : opts.slideCount - l;
|
762 |
|
|
else
|
763 |
|
|
hops = c < l ? l - c : l + opts.slideCount - c;
|
764 |
|
|
return hops;
|
765 |
|
|
};
|
766 |
|
|
|
767 |
|
|
|
768 |
|
|
|
769 |
|
|
function clearTypeFix($slides) {
|
770 |
|
|
debug('applying clearType background-color hack');
|
771 |
|
|
function hex(s) {
|
772 |
|
|
s = parseInt(s).toString(16);
|
773 |
|
|
return s.length < 2 ? '0'+s : s;
|
774 |
|
|
};
|
775 |
|
|
function getBg(e) {
|
776 |
|
|
for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
|
777 |
|
|
var v = $.css(e,'background-color');
|
778 |
|
|
if (v.indexOf('rgb') >= 0 ) {
|
779 |
|
|
var rgb = v.match(/\d+/g);
|
780 |
|
|
return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
|
781 |
|
|
}
|
782 |
|
|
if (v && v != 'transparent')
|
783 |
|
|
return v;
|
784 |
|
|
}
|
785 |
|
|
return '#ffffff';
|
786 |
|
|
};
|
787 |
|
|
$slides.each(function() { $(this).css('background-color', getBg(this)); });
|
788 |
|
|
};
|
789 |
|
|
|
790 |
|
|
|
791 |
|
|
$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
|
792 |
|
|
$(opts.elements).not(curr).hide();
|
793 |
|
|
opts.cssBefore.opacity = 1;
|
794 |
|
|
opts.cssBefore.display = 'block';
|
795 |
|
|
if (w !== false && next.cycleW > 0)
|
796 |
|
|
opts.cssBefore.width = next.cycleW;
|
797 |
|
|
if (h !== false && next.cycleH > 0)
|
798 |
|
|
opts.cssBefore.height = next.cycleH;
|
799 |
|
|
opts.cssAfter = opts.cssAfter || {};
|
800 |
|
|
opts.cssAfter.display = 'none';
|
801 |
|
|
$(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
|
802 |
|
|
$(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
|
803 |
|
|
};
|
804 |
|
|
|
805 |
|
|
|
806 |
|
|
$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
|
807 |
|
|
var $l = $(curr), $n = $(next);
|
808 |
|
|
var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
|
809 |
|
|
$n.css(opts.cssBefore);
|
810 |
|
|
if (speedOverride) {
|
811 |
|
|
if (typeof speedOverride == 'number')
|
812 |
|
|
speedIn = speedOut = speedOverride;
|
813 |
|
|
else
|
814 |
|
|
speedIn = speedOut = 1;
|
815 |
|
|
easeIn = easeOut = null;
|
816 |
|
|
}
|
817 |
|
|
var fn = function() {$n.animate(opts.animIn, speedIn, easeIn, cb)};
|
818 |
|
|
$l.animate(opts.animOut, speedOut, easeOut, function() {
|
819 |
|
|
if (opts.cssAfter) $l.css(opts.cssAfter);
|
820 |
|
|
if (!opts.sync) fn();
|
821 |
|
|
});
|
822 |
|
|
if (opts.sync) fn();
|
823 |
|
|
};
|
824 |
|
|
|
825 |
|
|
|
826 |
|
|
$.fn.cycle.transitions = {
|
827 |
|
|
fade: function($cont, $slides, opts) {
|
828 |
|
|
$slides.not(':eq('+opts.currSlide+')').css('opacity',0);
|
829 |
|
|
opts.before.push(function(curr,next,opts) {
|
830 |
|
|
$.fn.cycle.commonReset(curr,next,opts);
|
831 |
|
|
opts.cssBefore.opacity = 0;
|
832 |
|
|
});
|
833 |
|
|
opts.animIn = { opacity: 1 };
|
834 |
|
|
opts.animOut = { opacity: 0 };
|
835 |
|
|
opts.cssBefore = { top: 0, left: 0 };
|
836 |
|
|
}
|
837 |
|
|
};
|
838 |
|
|
|
839 |
|
|
$.fn.cycle.ver = function() { return ver; };
|
840 |
|
|
|
841 |
|
|
|
842 |
|
|
$.fn.cycle.defaults = {
|
843 |
|
|
fx: 'fade',
|
844 |
|
|
timeout: 4000,
|
845 |
|
|
timeoutFn: null,
|
846 |
|
|
continuous: 0,
|
847 |
|
|
speed: 1000,
|
848 |
|
|
speedIn: null,
|
849 |
|
|
speedOut: null,
|
850 |
|
|
next: null,
|
851 |
|
|
prev: null,
|
852 |
|
|
|
853 |
|
|
onPrevNextEvent: null,
|
854 |
|
|
prevNextEvent:'click.cycle',
|
855 |
|
|
pager: null,
|
856 |
|
|
|
857 |
|
|
onPagerEvent: null,
|
858 |
|
|
pagerEvent: 'click.cycle',
|
859 |
|
|
allowPagerClickBubble: false,
|
860 |
|
|
pagerAnchorBuilder: null,
|
861 |
|
|
before: null,
|
862 |
|
|
after: null,
|
863 |
|
|
end: null,
|
864 |
|
|
easing: null,
|
865 |
|
|
easeIn: null,
|
866 |
|
|
easeOut: null,
|
867 |
|
|
shuffle: null,
|
868 |
|
|
animIn: null,
|
869 |
|
|
animOut: null,
|
870 |
|
|
cssBefore: null,
|
871 |
|
|
cssAfter: null,
|
872 |
|
|
fxFn: null,
|
873 |
|
|
height: 'auto',
|
874 |
|
|
startingSlide: 0,
|
875 |
|
|
sync: 1,
|
876 |
|
|
random: 0,
|
877 |
|
|
fit: 0,
|
878 |
|
|
containerResize: 1,
|
879 |
|
|
pause: 0,
|
880 |
|
|
pauseOnPagerHover: 0,
|
881 |
|
|
autostop: 0,
|
882 |
|
|
autostopCount: 0,
|
883 |
|
|
delay: 0,
|
884 |
|
|
slideExpr: null,
|
885 |
|
|
cleartype: !$.support.opacity,
|
886 |
|
|
cleartypeNoBg: false,
|
887 |
|
|
nowrap: 0,
|
888 |
|
|
fastOnEvent: 0,
|
889 |
|
|
randomizeEffects: 1,
|
890 |
|
|
rev: 0,
|
891 |
|
|
manualTrump: true,
|
892 |
|
|
requeueOnImageNotLoaded: true,
|
893 |
|
|
requeueTimeout: 250,
|
894 |
|
|
activePagerClass: 'activeSlide',
|
895 |
|
|
updateActivePagerLink: null
|
896 |
|
|
};
|
897 |
|
|
|
898 |
|
|
})(jQuery);
|
899 |
|
|
|
900 |
|
|
|
901 |
|
|
|
902 |
|
|
|
903 |
|
|
|
904 |
|
|
|
905 |
|
|
|
906 |
|
|
|
907 |
|
|
|
908 |
|
|
|
909 |
|
|
|
910 |
|
|
|
911 |
|
|
(function($) {
|
912 |
|
|
|
913 |
|
|
|
914 |
|
|
|
915 |
|
|
|
916 |
|
|
|
917 |
|
|
|
918 |
|
|
$.fn.cycle.transitions.none = function($cont, $slides, opts) {
|
919 |
|
|
opts.fxFn = function(curr,next,opts,after){
|
920 |
|
|
$(next).show();
|
921 |
|
|
$(curr).hide();
|
922 |
|
|
after();
|
923 |
|
|
};
|
924 |
|
|
}
|
925 |
|
|
|
926 |
|
|
|
927 |
|
|
$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
|
928 |
|
|
$cont.css('overflow','hidden');
|
929 |
|
|
opts.before.push($.fn.cycle.commonReset);
|
930 |
|
|
var h = $cont.height();
|
931 |
|
|
opts.cssBefore ={ top: h, left: 0 };
|
932 |
|
|
opts.cssFirst = { top: 0 };
|
933 |
|
|
opts.animIn = { top: 0 };
|
934 |
|
|
opts.animOut = { top: -h };
|
935 |
|
|
};
|
936 |
|
|
$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
|
937 |
|
|
$cont.css('overflow','hidden');
|
938 |
|
|
opts.before.push($.fn.cycle.commonReset);
|
939 |
|
|
var h = $cont.height();
|
940 |
|
|
opts.cssFirst = { top: 0 };
|
941 |
|
|
opts.cssBefore= { top: -h, left: 0 };
|
942 |
|
|
opts.animIn = { top: 0 };
|
943 |
|
|
opts.animOut = { top: h };
|
944 |
|
|
};
|
945 |
|
|
$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
|
946 |
|
|
$cont.css('overflow','hidden');
|
947 |
|
|
opts.before.push($.fn.cycle.commonReset);
|
948 |
|
|
var w = $cont.width();
|
949 |
|
|
opts.cssFirst = { left: 0 };
|
950 |
|
|
opts.cssBefore= { left: w, top: 0 };
|
951 |
|
|
opts.animIn = { left: 0 };
|
952 |
|
|
opts.animOut = { left: 0-w };
|
953 |
|
|
};
|
954 |
|
|
$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
|
955 |
|
|
$cont.css('overflow','hidden');
|
956 |
|
|
opts.before.push($.fn.cycle.commonReset);
|
957 |
|
|
var w = $cont.width();
|
958 |
|
|
opts.cssFirst = { left: 0 };
|
959 |
|
|
opts.cssBefore= { left: -w, top: 0 };
|
960 |
|
|
opts.animIn = { left: 0 };
|
961 |
|
|
opts.animOut = { left: w };
|
962 |
|
|
};
|
963 |
|
|
$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
|
964 |
|
|
$cont.css('overflow','hidden').width();
|
965 |
|
|
opts.before.push(function(curr, next, opts, fwd) {
|
966 |
|
|
$.fn.cycle.commonReset(curr,next,opts);
|
967 |
|
|
opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
|
968 |
|
|
opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
|
969 |
|
|
});
|
970 |
|
|
opts.cssFirst = { left: 0 };
|
971 |
|
|
opts.cssBefore= { top: 0 };
|
972 |
|
|
opts.animIn = { left: 0 };
|
973 |
|
|
opts.animOut = { top: 0 };
|
974 |
|
|
};
|
975 |
|
|
$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
|
976 |
|
|
$cont.css('overflow','hidden');
|
977 |
|
|
opts.before.push(function(curr, next, opts, fwd) {
|
978 |
|
|
$.fn.cycle.commonReset(curr,next,opts);
|
979 |
|
|
opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
|
980 |
|
|
opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
|
981 |
|
|
});
|
982 |
|
|
opts.cssFirst = { top: 0 };
|
983 |
|
|
opts.cssBefore= { left: 0 };
|
984 |
|
|
opts.animIn = { top: 0 };
|
985 |
|
|
opts.animOut = { left: 0 };
|
986 |
|
|
};
|
987 |
|
|
|
988 |
|
|
|
989 |
|
|
$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
|
990 |
|
|
opts.before.push(function(curr, next, opts) {
|
991 |
|
|
$(opts.elements).not(curr).hide();
|
992 |
|
|
$.fn.cycle.commonReset(curr,next,opts,false,true);
|
993 |
|
|
opts.animIn.width = next.cycleW;
|
994 |
|
|
});
|
995 |
|
|
opts.cssBefore = { left: 0, top: 0, width: 0 };
|
996 |
|
|
opts.animIn = { width: 'show' };
|
997 |
|
|
opts.animOut = { width: 0 };
|
998 |
|
|
};
|
999 |
|
|
$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
|
1000 |
|
|
opts.before.push(function(curr, next, opts) {
|
1001 |
|
|
$(opts.elements).not(curr).hide();
|
1002 |
|
|
$.fn.cycle.commonReset(curr,next,opts,true,false);
|
1003 |
|
|
opts.animIn.height = next.cycleH;
|
1004 |
|
|
});
|
1005 |
|
|
opts.cssBefore = { left: 0, top: 0, height: 0 };
|
1006 |
|
|
opts.animIn = { height: 'show' };
|
1007 |
|
|
opts.animOut = { height: 0 };
|
1008 |
|
|
};
|
1009 |
|
|
|
1010 |
|
|
|
1011 |
|
|
$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
|
1012 |
|
|
var i, w = $cont.css('overflow', 'visible').width();
|
1013 |
|
|
$slides.css({left: 0, top: 0});
|
1014 |
|
|
opts.before.push(function(curr,next,opts) {
|
1015 |
|
|
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
|
1016 |
|
|
});
|
1017 |
|
|
|
1018 |
|
|
if (!opts.speedAdjusted) {
|
1019 |
|
|
opts.speed = opts.speed / 2;
|
1020 |
|
|
opts.speedAdjusted = true;
|
1021 |
|
|
}
|
1022 |
|
|
opts.random = 0;
|
1023 |
|
|
opts.shuffle = opts.shuffle || {left:-w, top:15};
|
1024 |
|
|
opts.els = [];
|
1025 |
|
|
for (i=0; i < $slides.length; i++)
|
1026 |
|
|
opts.els.push($slides[i]);
|
1027 |
|
|
|
1028 |
|
|
for (i=0; i < opts.currSlide; i++)
|
1029 |
|
|
opts.els.push(opts.els.shift());
|
1030 |
|
|
|
1031 |
|
|
|
1032 |
|
|
opts.fxFn = function(curr, next, opts, cb, fwd) {
|
1033 |
|
|
var $el = fwd ? $(curr) : $(next);
|
1034 |
|
|
$(next).css(opts.cssBefore);
|
1035 |
|
|
var count = opts.slideCount;
|
1036 |
|
|
$el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
|
1037 |
|
|
var hops = $.fn.cycle.hopsFromLast(opts, fwd);
|
1038 |
|
|
for (var k=0; k < hops; k++)
|
1039 |
|
|
fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
|
1040 |
|
|
if (fwd) {
|
1041 |
|
|
for (var i=0, len=opts.els.length; i < len; i++)
|
1042 |
|
|
$(opts.els[i]).css('z-index', len-i+count);
|
1043 |
|
|
}
|
1044 |
|
|
else {
|
1045 |
|
|
var z = $(curr).css('z-index');
|
1046 |
|
|
$el.css('z-index', parseInt(z)+1+count);
|
1047 |
|
|
}
|
1048 |
|
|
$el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
|
1049 |
|
|
$(fwd ? this : curr).hide();
|
1050 |
|
|
if (cb) cb();
|
1051 |
|
|
});
|
1052 |
|
|
});
|
1053 |
|
|
};
|
1054 |
|
|
opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 };
|
1055 |
|
|
};
|
1056 |
|
|
|
1057 |
|
|
|
1058 |
|
|
$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
|
1059 |
|
|
opts.before.push(function(curr, next, opts) {
|
1060 |
|
|
$.fn.cycle.commonReset(curr,next,opts,true,false);
|
1061 |
|
|
opts.cssBefore.top = next.cycleH;
|
1062 |
|
|
opts.animIn.height = next.cycleH;
|
1063 |
|
|
});
|
1064 |
|
|
opts.cssFirst = { top: 0 };
|
1065 |
|
|
opts.cssBefore = { left: 0, height: 0 };
|
1066 |
|
|
opts.animIn = { top: 0 };
|
1067 |
|
|
opts.animOut = { height: 0 };
|
1068 |
|
|
};
|
1069 |
|
|
$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
|
1070 |
|
|
opts.before.push(function(curr, next, opts) {
|
1071 |
|
|
$.fn.cycle.commonReset(curr,next,opts,true,false);
|
1072 |
|
|
opts.animIn.height = next.cycleH;
|
1073 |
|
|
opts.animOut.top = curr.cycleH;
|
1074 |
|
|
});
|
1075 |
|
|
opts.cssFirst = { top: 0 };
|
1076 |
|
|
opts.cssBefore = { left: 0, top: 0, height: 0 };
|
1077 |
|
|
opts.animOut = { height: 0 };
|
1078 |
|
|
};
|
1079 |
|
|
$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
|
1080 |
|
|
opts.before.push(function(curr, next, opts) {
|
1081 |
|
|
$.fn.cycle.commonReset(curr,next,opts,false,true);
|
1082 |
|
|
opts.cssBefore.left = next.cycleW;
|
1083 |
|
|
opts.animIn.width = next.cycleW;
|
1084 |
|
|
});
|
1085 |
|
|
opts.cssBefore = { top: 0, width: 0 };
|
1086 |
|
|
opts.animIn = { left: 0 };
|
1087 |
|
|
opts.animOut = { width: 0 };
|
1088 |
|
|
};
|
1089 |
|
|
$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
|
1090 |
|
|
opts.before.push(function(curr, next, opts) {
|
1091 |
|
|
$.fn.cycle.commonReset(curr,next,opts,false,true);
|
1092 |
|
|
opts.animIn.width = next.cycleW;
|
1093 |
|
|
opts.animOut.left = curr.cycleW;
|
1094 |
|
|
});
|
1095 |
|
|
opts.cssBefore = { top: 0, left: 0, width: 0 };
|
1096 |
|
|
opts.animIn = { left: 0 };
|
1097 |
|
|
opts.animOut = { width: 0 };
|
1098 |
|
|
};
|
1099 |
|
|
|
1100 |
|
|
|
1101 |
|
|
$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
|
1102 |
|
|
opts.before.push(function(curr, next, opts) {
|
1103 |
|
|
$.fn.cycle.commonReset(curr,next,opts,false,false,true);
|
1104 |
|
|
opts.cssBefore.top = next.cycleH/2;
|
1105 |
|
|
opts.cssBefore.left = next.cycleW/2;
|
1106 |
|
|
opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
|
1107 |
|
|
opts.animOut = { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 };
|
1108 |
|
|
});
|
1109 |
|
|
opts.cssFirst = { top:0, left: 0 };
|
1110 |
|
|
opts.cssBefore = { width: 0, height: 0 };
|
1111 |
|
|
};
|
1112 |
|
|
|
1113 |
|
|
|
1114 |
|
|
$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
|
1115 |
|
|
opts.before.push(function(curr, next, opts) {
|
1116 |
|
|
$.fn.cycle.commonReset(curr,next,opts,false,false);
|
1117 |
|
|
opts.cssBefore.left = next.cycleW/2;
|
1118 |
|
|
opts.cssBefore.top = next.cycleH/2;
|
1119 |
|
|
opts.animIn = { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
|
1120 |
|
|
});
|
1121 |
|
|
opts.cssBefore = { width: 0, height: 0 };
|
1122 |
|
|
opts.animOut = { opacity: 0 };
|
1123 |
|
|
};
|
1124 |
|
|
|
1125 |
|
|
|
1126 |
|
|
$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
|
1127 |
|
|
var w = $cont.css('overflow','hidden').width();
|
1128 |
|
|
opts.before.push(function(curr, next, opts) {
|
1129 |
|
|
$.fn.cycle.commonReset(curr,next,opts);
|
1130 |
|
|
opts.animIn.width = next.cycleW;
|
1131 |
|
|
opts.animOut.left = curr.cycleW;
|
1132 |
|
|
});
|
1133 |
|
|
opts.cssBefore = { left: w, top: 0 };
|
1134 |
|
|
opts.animIn = { left: 0 };
|
1135 |
|
|
opts.animOut = { left: w };
|
1136 |
|
|
};
|
1137 |
|
|
|
1138 |
|
|
$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
|
1139 |
|
|
var h = $cont.css('overflow','hidden').height();
|
1140 |
|
|
opts.before.push(function(curr, next, opts) {
|
1141 |
|
|
$.fn.cycle.commonReset(curr,next,opts);
|
1142 |
|
|
opts.animIn.height = next.cycleH;
|
1143 |
|
|
opts.animOut.top = curr.cycleH;
|
1144 |
|
|
});
|
1145 |
|
|
opts.cssBefore = { top: h, left: 0 };
|
1146 |
|
|
opts.animIn = { top: 0 };
|
1147 |
|
|
opts.animOut = { top: h };
|
1148 |
|
|
};
|
1149 |
|
|
|
1150 |
|
|
$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
|
1151 |
|
|
var h = $cont.css('overflow','hidden').height();
|
1152 |
|
|
var w = $cont.width();
|
1153 |
|
|
opts.before.push(function(curr, next, opts) {
|
1154 |
|
|
$.fn.cycle.commonReset(curr,next,opts);
|
1155 |
|
|
opts.animIn.height = next.cycleH;
|
1156 |
|
|
opts.animOut.top = curr.cycleH;
|
1157 |
|
|
});
|
1158 |
|
|
opts.cssBefore = { top: h, left: w };
|
1159 |
|
|
opts.animIn = { top: 0, left: 0 };
|
1160 |
|
|
opts.animOut = { top: h, left: w };
|
1161 |
|
|
};
|
1162 |
|
|
|
1163 |
|
|
|
1164 |
|
|
$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
|
1165 |
|
|
opts.before.push(function(curr, next, opts) {
|
1166 |
|
|
$.fn.cycle.commonReset(curr,next,opts,false,true);
|
1167 |
|
|
opts.cssBefore.left = this.cycleW/2;
|
1168 |
|
|
opts.animIn = { left: 0, width: this.cycleW };
|
1169 |
|
|
opts.animOut = { left: 0 };
|
1170 |
|
|
});
|
1171 |
|
|
opts.cssBefore = { width: 0, top: 0 };
|
1172 |
|
|
};
|
1173 |
|
|
|
1174 |
|
|
$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
|
1175 |
|
|
opts.before.push(function(curr, next, opts) {
|
1176 |
|
|
$.fn.cycle.commonReset(curr,next,opts,true,false);
|
1177 |
|
|
opts.cssBefore.top = this.cycleH/2;
|
1178 |
|
|
opts.animIn = { top: 0, height: this.cycleH };
|
1179 |
|
|
opts.animOut = { top: 0 };
|
1180 |
|
|
});
|
1181 |
|
|
opts.cssBefore = { height: 0, left: 0 };
|
1182 |
|
|
};
|
1183 |
|
|
|
1184 |
|
|
|
1185 |
|
|
$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
|
1186 |
|
|
opts.before.push(function(curr, next, opts) {
|
1187 |
|
|
$.fn.cycle.commonReset(curr,next,opts,false,true,true);
|
1188 |
|
|
opts.cssBefore.left = next.cycleW/2;
|
1189 |
|
|
opts.animIn = { left: 0, width: this.cycleW };
|
1190 |
|
|
opts.animOut = { left: curr.cycleW/2, width: 0 };
|
1191 |
|
|
});
|
1192 |
|
|
opts.cssBefore = { top: 0, width: 0 };
|
1193 |
|
|
};
|
1194 |
|
|
|
1195 |
|
|
$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
|
1196 |
|
|
opts.before.push(function(curr, next, opts) {
|
1197 |
|
|
$.fn.cycle.commonReset(curr,next,opts,true,false,true);
|
1198 |
|
|
opts.cssBefore.top = next.cycleH/2;
|
1199 |
|
|
opts.animIn = { top: 0, height: next.cycleH };
|
1200 |
|
|
opts.animOut = { top: curr.cycleH/2, height: 0 };
|
1201 |
|
|
});
|
1202 |
|
|
opts.cssBefore = { left: 0, height: 0 };
|
1203 |
|
|
};
|
1204 |
|
|
|
1205 |
|
|
|
1206 |
|
|
$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
|
1207 |
|
|
var d = opts.direction || 'left';
|
1208 |
|
|
var w = $cont.css('overflow','hidden').width();
|
1209 |
|
|
var h = $cont.height();
|
1210 |
|
|
opts.before.push(function(curr, next, opts) {
|
1211 |
|
|
$.fn.cycle.commonReset(curr,next,opts);
|
1212 |
|
|
if (d == 'right')
|
1213 |
|
|
opts.cssBefore.left = -w;
|
1214 |
|
|
else if (d == 'up')
|
1215 |
|
|
opts.cssBefore.top = h;
|
1216 |
|
|
else if (d == 'down')
|
1217 |
|
|
opts.cssBefore.top = -h;
|
1218 |
|
|
else
|
1219 |
|
|
opts.cssBefore.left = w;
|
1220 |
|
|
});
|
1221 |
|
|
opts.animIn = { left: 0, top: 0};
|
1222 |
|
|
opts.animOut = { opacity: 1 };
|
1223 |
|
|
opts.cssBefore = { top: 0, left: 0 };
|
1224 |
|
|
};
|
1225 |
|
|
|
1226 |
|
|
|
1227 |
|
|
$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
|
1228 |
|
|
var d = opts.direction || 'left';
|
1229 |
|
|
var w = $cont.css('overflow','hidden').width();
|
1230 |
|
|
var h = $cont.height();
|
1231 |
|
|
opts.before.push(function(curr, next, opts) {
|
1232 |
|
|
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
|
1233 |
|
|
if (d == 'right')
|
1234 |
|
|
opts.animOut.left = w;
|
1235 |
|
|
else if (d == 'up')
|
1236 |
|
|
opts.animOut.top = -h;
|
1237 |
|
|
else if (d == 'down')
|
1238 |
|
|
opts.animOut.top = h;
|
1239 |
|
|
else
|
1240 |
|
|
opts.animOut.left = -w;
|
1241 |
|
|
});
|
1242 |
|
|
opts.animIn = { left: 0, top: 0 };
|
1243 |
|
|
opts.animOut = { opacity: 1 };
|
1244 |
|
|
opts.cssBefore = { top: 0, left: 0 };
|
1245 |
|
|
};
|
1246 |
|
|
|
1247 |
|
|
|
1248 |
|
|
$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
|
1249 |
|
|
var w = $cont.css('overflow','visible').width();
|
1250 |
|
|
var h = $cont.height();
|
1251 |
|
|
opts.before.push(function(curr, next, opts) {
|
1252 |
|
|
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
|
1253 |
|
|
|
1254 |
|
|
if (!opts.animOut.left && !opts.animOut.top)
|
1255 |
|
|
opts.animOut = { left: w*2, top: -h/2, opacity: 0 };
|
1256 |
|
|
else
|
1257 |
|
|
opts.animOut.opacity = 0;
|
1258 |
|
|
});
|
1259 |
|
|
opts.cssBefore = { left: 0, top: 0 };
|
1260 |
|
|
opts.animIn = { left: 0 };
|
1261 |
|
|
};
|
1262 |
|
|
|
1263 |
|
|
|
1264 |
|
|
$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
|
1265 |
|
|
var w = $cont.css('overflow','hidden').width();
|
1266 |
|
|
var h = $cont.height();
|
1267 |
|
|
opts.cssBefore = opts.cssBefore || {};
|
1268 |
|
|
var clip;
|
1269 |
|
|
if (opts.clip) {
|
1270 |
|
|
if (/l2r/.test(opts.clip))
|
1271 |
|
|
clip = 'rect(0px 0px '+h+'px 0px)';
|
1272 |
|
|
else if (/r2l/.test(opts.clip))
|
1273 |
|
|
clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
|
1274 |
|
|
else if (/t2b/.test(opts.clip))
|
1275 |
|
|
clip = 'rect(0px '+w+'px 0px 0px)';
|
1276 |
|
|
else if (/b2t/.test(opts.clip))
|
1277 |
|
|
clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
|
1278 |
|
|
else if (/zoom/.test(opts.clip)) {
|
1279 |
|
|
var top = parseInt(h/2);
|
1280 |
|
|
var left = parseInt(w/2);
|
1281 |
|
|
clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
|
1282 |
|
|
}
|
1283 |
|
|
}
|
1284 |
|
|
|
1285 |
|
|
opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
|
1286 |
|
|
|
1287 |
|
|
var d = opts.cssBefore.clip.match(/(\d+)/g);
|
1288 |
|
|
var t = parseInt(d[0]), r = parseInt(d[1]), b = parseInt(d[2]), l = parseInt(d[3]);
|
1289 |
|
|
|
1290 |
|
|
opts.before.push(function(curr, next, opts) {
|
1291 |
|
|
if (curr == next) return;
|
1292 |
|
|
var $curr = $(curr), $next = $(next);
|
1293 |
|
|
$.fn.cycle.commonReset(curr,next,opts,true,true,false);
|
1294 |
|
|
opts.cssAfter.display = 'block';
|
1295 |
|
|
|
1296 |
|
|
var step = 1, count = parseInt((opts.speedIn / 13)) - 1;
|
1297 |
|
|
(function f() {
|
1298 |
|
|
var tt = t ? t - parseInt(step * (t/count)) : 0;
|
1299 |
|
|
var ll = l ? l - parseInt(step * (l/count)) : 0;
|
1300 |
|
|
var bb = b < h ? b + parseInt(step * ((h-b)/count || 1)) : h;
|
1301 |
|
|
var rr = r < w ? r + parseInt(step * ((w-r)/count || 1)) : w;
|
1302 |
|
|
$next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
|
1303 |
|
|
(step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
|
1304 |
|
|
})();
|
1305 |
|
|
});
|
1306 |
|
|
opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 };
|
1307 |
|
|
opts.animIn = { left: 0 };
|
1308 |
|
|
opts.animOut = { left: 0 };
|
1309 |
|
|
};
|
1310 |
|
|
|
1311 |
|
|
})(jQuery); |