-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.slidertron-1.3.js
executable file
·1124 lines (884 loc) · 30 KB
/
jquery.slidertron-1.3.js
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Slidertron 1.3: A flexible slider plugin for jQuery
By n33 | http://n33.co | @n33co
Dual licensed under the MIT or GPLv2 license.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MIT LICENSE:
Copyright (c) 2012 n33, http://n33.co
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
GPLv2 LICENSE:
Copyright (c) 2012 n33, http://n33.co
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of
the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
*/
(function(jQuery) {
jQuery.fn.disableSelection_slidertron = function() { return jQuery(this).css('user-select', 'none').css('-khtml-user-select', 'none').css('-moz-user-select', 'none').css('-o-user-select', 'none').css('-webkit-user-select', 'none'); }
jQuery.fn.slidertron = function(options) {
var settings = jQuery.extend({
selectorParent: jQuery(this)
}, options);
return jQuery.slidertron(settings);
}
jQuery.slidertron = function(options) {
// Settings
var settings = jQuery.extend({
selectorParent: null, // If a jQuery object, all selectors will be restricted to its scope. Otherwise, all selectors will be global.
// Selectors
viewerSelector: null, // Viewer selector
reelSelector: null, // Reel selector
slidesSelector: null, // Slides selector
indicatorSelector: null, // Indicator selector
jumpLinksSelector: null, // Jump links selector
navNextSelector: null, // 'Next' selector
navPreviousSelector: null, // 'Previous' selector
navFirstSelector: null, // 'First' selector
navLastSelector: null, // 'Last' selector
navStopAdvanceSelector: null, // 'Stop Advance' selector
navPlayAdvanceSelector: null, // 'Play Advance' selector
captionLineSelector: null, // 'Caption Line' selector
slideLinkSelector: null, // 'Slide Link' selector
slideCaptionSelector: null, // 'Slide Caption' selector
// General settings
mode: 'fade', // Slider mode ('slide', 'fade', 'fadeIn')
speed: 'fast', // Transition speed (0 for instant, 'slow', 'fast', or a custom duration in ms)
fadeInSpeed: 'slow', // Speed at which to fade in the reel on page load (0 for instant, 'slow', 'fast', or a custom duration in ms)
navWrap: true, // Wrap navigation when we navigate past the first or last slide
seamlessWrap: true, // Seamlessly wrap slides
advanceDelay: 0, // Time to wait (in ms) before automatically advancing to the next slide (0 disables advancement entirely)
advanceWait: 0, // Time to wait before starting automatic advancement
advanceNavActiveClass: 'active', // Class applied to active stop/play navigation control
advanceDirection: 'forward', // Direction to advance ('forward', 'backward', 'random')
viewerOffset: false, // Viewer offset amount (+ = shift right, - = shift left, 0 = do nothing, false = disable)
activeSlideClass: 'active', // Class applied to the active slide
disabledNavClass: 'disabled', // Class applied to disabled navigation controls
clickToNav: false, // Navigate to a slide when clicked (used in conjunction with viewerOffset)
captionLines: 0, // Number of caption lines. If this is > 1, the plugin will look for additional caption elements using the captionSelector setting + a number (eg. '.caption2', '.caption3', etc.)
autoHideNav: false, // Automatically hides the navigation buttons if they're not needed
autoFit: false, // Automatically sets the width and height of the slider based on available space (requires autoFitAspectRatio)
autoFitAspectRatio: 0.5, // Used by autoFit to determine the slider's dimensions (value is width / height)
initialSlide: 1, // Initial slide (a number or 'random' for a random slide)
hashJump: false, // If true, slider will start at the slide pointed to by the ID given by the URL hashmark (eg. #something)
hashJumpStopAdvance: true, // If true (and hashJump is enabled), slider will begin in a stopped state when a hashmark is detected
activeJumpLinkClass: 'active', // Class applied to the active jump link
arrowsToNav: false, // If true, the left/right arrow keys will be used for navigation
blurOnChange: false, // If true, defocuses any input elements on slide change
navSize: 1, // ...
// Callbacks
onSlideSwitch: false
}, options);
// Variables
// Operational stuff
var isConfigured = true,
isLocked = false,
isAdvancing = false,
isSeamless = false,
list = new Array(),
currentIndex = false,
timeoutID,
pFirst,
pLast;
var _isTouch = !!('ontouchstart' in window), _eventType = (_isTouch ? 'touchend' : 'click');
// jQuery objects
var __slides,
__viewer,
__reel,
__indicator,
__navFirst,
__navLast,
__navNext,
__navPrevious,
__navStopAdvance,
__navPlayAdvance,
__captionLines,
__navControls = new Array(),
__jumpLinks;
// Functions
function getElement(selector, required, global)
{
var x;
try
{
if (selector == null)
throw 'is undefined';
if (settings.selectorParent && !global)
x = settings.selectorParent.find(selector);
else
x = jQuery(selector);
if (x.length == 0)
throw 'does not exist';
x.disableSelection_slidertron();
return x;
}
catch (error)
{
if (required == true)
{
alert('Error: Required selector "' + selector + '" ' + error + '.');
isConfigured = false;
}
}
return null;
}
function advance()
{
if (settings.advanceDelay == 0)
return;
if (!isLocked)
{
switch (settings.advanceDirection)
{
case 'random':
var x = __slides.length - 1, y;
if (settings.seamlessWrap && settings.mode == 'slide')
x -= 3;
if (x < 2)
break;
while ( (y = Math.ceil(Math.random() * x)) == currentIndex ) { }
switchSlide(y);
break;
case 'backward':
previousSlide();
break;
case 'forward':
default:
nextSlide();
break;
}
}
timeoutID = window.setTimeout(advance, settings.advanceDelay);
}
function initializeAdvance()
{
if (settings.advanceDelay == 0)
return;
if (__navStopAdvance)
__navStopAdvance.addClass(settings.advanceNavActiveClass);
if (__navPlayAdvance)
__navPlayAdvance.removeClass(settings.advanceNavActiveClass);
isAdvancing = true;
timeoutID = window.setTimeout(advance, settings.advanceDelay);
}
function interruptAdvance()
{
stopAdvance();
}
function stopAdvance()
{
if (settings.advanceDelay == 0)
return;
if (!isAdvancing)
return;
if (__navStopAdvance && __navPlayAdvance)
{
__navStopAdvance.removeClass(settings.advanceNavActiveClass);
__navPlayAdvance.addClass(settings.advanceNavActiveClass);
}
isAdvancing = false;
window.clearTimeout(timeoutID);
}
function playAdvance(skip)
{
if (settings.advanceDelay == 0)
return;
if (isAdvancing)
return;
isAdvancing = true;
if (__navStopAdvance && __navPlayAdvance)
{
__navPlayAdvance.removeClass(settings.advanceNavActiveClass);
__navStopAdvance.addClass(settings.advanceNavActiveClass);
}
if (skip)
timeoutID = window.setTimeout(advance, settings.advanceDelay);
else
advance();
}
function getSlideById(id)
{
var x;
for (x in list)
{
if (list[x].id == id)
return x;
}
return false;
}
function firstSlide()
{
switchSlide(pFirst);
}
function lastSlide()
{
switchSlide(pLast);
}
function nextSlide()
{
var x = false;
if ((isSeamless && currentIndex <= pLast)
|| (!isSeamless && currentIndex < pLast))
x = parseInt(currentIndex) + settings.navSize;
else if (settings.navWrap || isAdvancing)
x = pFirst;
if (x > pLast)
x = pLast;
else if (x < 0)
x = 0;
if (x !== false)
switchSlide(x);
}
function previousSlide()
{
var x = false;
if ((isSeamless && currentIndex >= pFirst)
|| (!isSeamless && currentIndex > pFirst))
x = parseInt(currentIndex) - settings.navSize;
else if (settings.navWrap)
x = pLast;
if (x > pLast)
x = pLast;
else if (x < 0)
x = 0;
if (x !== false)
switchSlide(x);
}
function updateJumpLink(index)
{
if (!__jumpLinks
|| !list[index].jumpLink)
return;
__jumpLinks.removeClass(settings.activeJumpLinkClass);
list[index].jumpLink.addClass(settings.activeJumpLinkClass);
}
function updateURL()
{
if (!settings.hashJump
|| !list[currentIndex].id)
return;
if (currentIndex != pFirst)
window.location.replace('#' + list[currentIndex].id);
else
window.location.replace('#');
}
function updateNavControls()
{
if (settings.disabledNavClass === false
|| settings.navWrap === true)
return;
for (x in __navControls)
if (__navControls[x])
__navControls[x].removeClass(settings.disabledNavClass).css('cursor', 'pointer');
var tmp = new Array();
if (currentIndex == pFirst)
{
tmp.push(__navFirst);
tmp.push(__navPrevious);
}
if (currentIndex == pLast)
{
tmp.push(__navLast);
tmp.push(__navNext);
}
for (x in tmp)
if (tmp[x])
tmp[x].addClass(settings.disabledNavClass).css('cursor', 'default');
}
function switchSlide(index)
{
var x;
if (isLocked || currentIndex === index)
return false;
if (__jumpLinks)
__jumpLinks.removeClass(settings.activeJumpLinkClass);
if (settings.blurOnChange)
jQuery('input, textarea, select').blur();
isLocked = true;
if (currentIndex === false)
{
currentIndex = index;
__reel.css('left', -1 * list[currentIndex].x);
isLocked = false;
// Indicator
if (__indicator)
{
__indicator.removeClass('active');
jQuery(__indicator.get(currentIndex - pFirst)).addClass('active');
}
// Active slide
if (settings.activeSlideClass)
list[currentIndex].object
.addClass(settings.activeSlideClass)
// Link
if (settings.clickToNav && !list[currentIndex].link)
list[currentIndex].object
.css('cursor', 'default');
// Captions
if (__captionLines)
{
if (list[currentIndex].captions)
for (x in __captionLines)
__captionLines[x].html(list[currentIndex].captions[x]);
else
for (x in __captionLines)
__captionLines[x].html('');
}
// Nav controls
updateNavControls();
// Update jump link
updateJumpLink(currentIndex);
// Callback
if (settings.onSlideSwitch)
{
window.setTimeout(function() {
(settings.onSlideSwitch(list[currentIndex].object));
}, 500);
}
}
else
{
var diff, currentX, newX, realIndex;
if (settings.activeSlideClass)
list[currentIndex].object
.removeClass(settings.activeSlideClass);
if (settings.clickToNav)
list[currentIndex].object
.css('cursor', 'pointer');
currentX = list[currentIndex].x;
newX = list[index].x;
diff = currentX - newX;
// Get real index
if (list[index].realIndex !== false)
realIndex = list[index].realIndex;
else
realIndex = index;
// Indicator
if (__indicator)
{
__indicator.removeClass('active');
jQuery(__indicator.get(realIndex - pFirst)).addClass('active');
}
// Captions
if (__captionLines)
{
if (list[realIndex].captions)
for (x in __captionLines)
__captionLines[x].html(list[realIndex].captions[x]);
else
for (x in __captionLines)
__captionLines[x].html('');
}
// Update jump link
updateJumpLink(realIndex);
// Transition
switch (settings.mode)
{
case 'fadeIn':
// Clone active slide
x = list[currentIndex].object.clone();
x
.appendTo(__viewer)
.css('left', 0)
.css('top', 0);
// Switch slide
currentIndex = index;
__reel.css('left', -1 * list[currentIndex].x);
// Get real index and adjust reel position
if (list[currentIndex].realIndex !== false)
{
currentIndex = list[currentIndex].realIndex;
__reel.css('left', -1 * list[currentIndex].x);
}
// Active slide
if (settings.activeSlideClass)
list[currentIndex].object
.addClass(settings.activeSlideClass);
// Link
if (settings.clickToNav && !list[currentIndex].link)
list[currentIndex].object
.css('cursor', 'default');
// Nav controls
updateNavControls();
// Update URL
updateURL();
// Callback
if (settings.onSlideSwitch)
(settings.onSlideSwitch(list[currentIndex].object));
// Fade out and remove itcloned slide
x.fadeOut(settings.speed, function() {
isLocked = false;
x.remove();
});
break;
case 'fade':
__reel.fadeTo(settings.speed, 0.001, function() {
currentIndex = index;
__reel.css('left', -1 * list[currentIndex].x);
// Get real index and adjust reel position
if (list[currentIndex].realIndex !== false)
{
currentIndex = list[currentIndex].realIndex;
__reel.css('left', -1 * list[currentIndex].x);
}
__reel.fadeTo(settings.speed, 1, function() {
// Active slide
if (settings.activeSlideClass)
list[currentIndex].object
.addClass(settings.activeSlideClass);
// Link
if (settings.clickToNav && !list[currentIndex].link)
list[currentIndex].object
.css('cursor', 'default');
// Nav controls
updateNavControls();
// Update URL
updateURL();
// Callback
if (settings.onSlideSwitch)
(settings.onSlideSwitch(list[currentIndex].object));
isLocked = false;
});
});
break;
case 'slide':
default:
__reel.animate({ left: '+=' + diff }, settings.speed, 'swing', function() {
currentIndex = index;
// Get real index and adjust reel position
if (list[currentIndex].realIndex !== false)
{
currentIndex = list[currentIndex].realIndex;
__reel.css('left', -1 * list[currentIndex].x);
}
// Active slide
if (settings.activeSlideClass)
list[currentIndex].object
.addClass(settings.activeSlideClass);
// Link
if (settings.clickToNav && !list[currentIndex].link)
list[currentIndex].object
.css('cursor', 'default');
// Nav controls
updateNavControls();
// Update URL
updateURL();
// Callback
if (settings.onSlideSwitch)
(settings.onSlideSwitch(list[currentIndex].object));
isLocked = false;
});
break;
}
}
}
function initialize()
{
var tmp, a, s;
list = new Array();
// Slides, viewer, reel, indicator
__viewer = getElement(settings.viewerSelector, true);
__reel = getElement(settings.reelSelector, true);
__slides = getElement(settings.slidesSelector, true);
__indicator = getElement(settings.indicatorSelector, false);
__jumpLinks = getElement(settings.jumpLinksSelector, false, true);
if (settings.autoFit)
{
__viewer.height(Math.floor(__viewer.width() / settings.autoFitAspectRatio));
__slides
.width(__viewer.width())
.height(__viewer.height());
}
// Caption lines
a = new Array();
for (i = 1; i <= settings.captionLines; i++)
{
s = settings.captionLineSelector;
if (settings.captionLines > 1)
s = s + i;
tmp = getElement(s, false);
if (tmp == null)
{
a = null;
break;
}
a.push(tmp);
}
__captionLines = a;
// Navigation
__navFirst = getElement(settings.navFirstSelector);
__navLast = getElement(settings.navLastSelector);
__navNext = getElement(settings.navNextSelector);
__navPrevious = getElement(settings.navPreviousSelector);
__navStopAdvance = getElement(settings.navStopAdvanceSelector);
__navPlayAdvance = getElement(settings.navPlayAdvanceSelector);
if (__navFirst) __navControls.push(__navFirst);
if (__navLast) __navControls.push(__navLast);
if (__navNext) __navControls.push(__navNext);
if (__navPrevious) __navControls.push(__navPrevious);
if (settings.autoHideNav
&& __slides.length < 2)
{
for (x in __navControls)
__navControls[x].remove();
}
// Check configuration status
// ClickToNav only works when viewerOffset != false
if (settings.viewerOffset === false
&& settings.clickToNav)
{
alert('Error: clickToNav only works when viewerOffset is in use.');
return false;
}
// When using the indicator, it must have as many items as there are slides
if (__indicator)
{
if (__indicator.length != __slides.length)
{
alert('Error: Indicator needs to have as many items as there are slides.');
return false;
}
}
// Final check
if (isConfigured == false)
{
alert('Error: One or more configuration errors detected. Aborting.');
return false;
}
if (settings.viewerOffset == false)
settings.viewerOffset = 0;
if (settings.initialSlide == 'random')
settings.initialSlide = Math.ceil(Math.random() * __slides.length);
else if (isNaN(parseInt(settings.initialSlide)) == true || settings.initialSlide < 1 || settings.initialSlide > __slides.length)
settings.initialSlide = 1;
// Set up
// Viewer
__viewer.css('position', 'relative');
__viewer.css('overflow', 'hidden');
// Reel
__reel.css('position', 'absolute');
__reel.css('left', 0);
__reel.css('top', 0);
__reel.hide();
// Slides
var cx = 0, length = __slides.length;
if (settings.seamlessWrap && settings.mode == 'slide')
{
isSeamless = true;
var L1 = __slides.eq(0);
var L2 = __slides.eq(Math.min(length - 1, 1));
var R2 = __slides.eq(Math.max(length - 2, 0));
var R1 = __slides.eq(Math.max(length - 1, 0));
var realFirst = L1;
var realLast = R1;
var CL1 = L1.clone(),
CL2 = L2.clone(),
CR1 = R1.clone(),
CR2 = R2.clone();
CL1.attr('id', '');
CL2.attr('id', '');
CR1.attr('id', '');
CR2.attr('id', '');
CR2.insertBefore(realFirst);
CR1.insertBefore(realFirst);
CL2.insertAfter(realLast);
CL1.insertAfter(realLast);
__slides = getElement(settings.slidesSelector, true);
pFirst = 2;
pLast = __slides.length - 3;
}
else
{
pFirst = 0;
pLast = length - 1;
}
__slides.each(function(index) {
var y = jQuery(this), link = false, captions = new Array();
var l, i, tmp, s, id, p;
// click to nav?
if (settings.clickToNav)
{
y
.css('cursor', 'pointer')
.click(function(e) {
if (currentIndex != index)
{
e.stopPropagation();
if (isAdvancing)
interruptAdvance();
switchSlide(index);
}
});
}
// Link?
var l = y.find(settings.slideLinkSelector);
if (l.length > 0)
{
link = l.attr('href');
l.remove();
y
.css('cursor', 'pointer')
.click(function(e) {
if (currentIndex == index)
window.location = link;
});
}
// Caption(s)?
for (i = 1; i <= settings.captionLines; i++)
{
s = settings.slideCaptionSelector;
if (settings.captionLines > 1)
s = s + i;
tmp = y.find(s);
if (tmp.length > 0)
{
captions.push(tmp.html());
tmp.remove();
}
}
if (captions.length != settings.captionLines)
captions = false;
// id
id = y.attr('id');
if (!id)
id = null;
y.attr('id', '');
list[index] = {
object: y,
x: cx - settings.viewerOffset,
realIndex: false,
link: link,
captions: captions,
id: id,
jumpLink: false
};
y.css('position', 'absolute');
y.css('left', cx);
y.css('top', 0);
cx += y.width();
});
if (isSeamless)
{
list[pFirst - 1].realIndex = pLast;
list[pLast + 1].realIndex = pFirst;
}
// Indicator
if (__indicator)
{
__indicator.each(function() {
var t = jQuery(this);
t
.css('cursor', 'pointer')
.bind(_eventType, function(event) {
event.preventDefault();
if (isLocked)
return false;
if (isAdvancing)
interruptAdvance();
switchSlide(t.index() + pFirst);
});
if (_eventType != 'click')
t.click(function(e) { e.preventDefault(); });
});
}
// Jump links
if (__jumpLinks)
{
__jumpLinks.each(function() {
var i, t = jQuery(this), slideId = t.attr('href').split('#')[1];
if ((i = getSlideById(slideId)) !== false)
{
list[i].jumpLink = t;
t.click(function(e) {
e.preventDefault();
if (isAdvancing)
interruptAdvance();
switchSlide(i);
});
}
else
t.click(function(e) {
e.preventDefault();
});
});
}
// Navigation
if (__navFirst)
{
__navFirst.bind(_eventType, function(event) {
event.preventDefault();
if (isLocked)
return false;
if (isAdvancing)
interruptAdvance();
firstSlide();
});
if (_eventType != 'click')
__navFirst.click(function(e) { e.preventDefault(); });
}
if (__navLast)
{
__navLast.bind(_eventType, function(event) {
event.preventDefault();
if (isLocked)
return false;
if (isAdvancing)
interruptAdvance();
lastSlide();
});
if (_eventType != 'click')
__navLast.click(function(e) { e.preventDefault(); });
}
if (__navNext)
{
__navNext.bind(_eventType, function(event) {
event.preventDefault();
if (isLocked)
return false;
if (isAdvancing)
interruptAdvance();
nextSlide();
});
if (_eventType != 'click')
__navNext.click(function(e) { e.preventDefault(); });
}
if (__navPrevious)
{
__navPrevious.bind(_eventType, function(event) {
event.preventDefault();
if (isLocked)
return false;
if (isAdvancing)
interruptAdvance();
previousSlide();
});
if (_eventType != 'click')
__navPrevious.click(function(e) { e.preventDefault(); });
}
if (__navStopAdvance)
{
__navStopAdvance.bind(_eventType, function(event) {
event.preventDefault();
if (isLocked)
return false;
if (!isAdvancing)
return false;
stopAdvance();
});
if (_eventType != 'click')
__navStopAdvance.click(function(e) { e.preventDefault(); });
}
if (__navPlayAdvance)
{
__navPlayAdvance.bind(_eventType, function(event) {
event.preventDefault();