bxslider-rails 4.2.3 → 4.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/bxslider-rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.bxslider.js +1586 -1540
- data/vendor/assets/stylesheets/bxslider.css.scss +13 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5721fb2873fdb30cb74d32487970720006cf203
|
4
|
+
data.tar.gz: e47d256bec47b063a34e0c548269fbf19a352831
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9bc9088ffb39c70dfd6558e5461ed32b62334ea24f8c42e6ccb771aa0a92da5a17b1189ce3de9335264aca14ecdee44d5088ea261b0d62c449e89d8d7b1abef
|
7
|
+
data.tar.gz: 2063d3858c87b1b0b202e7993652928f58823af43851a3211675d805243b5b048e00f953a2fd2492d6d7f04efe588cd087a7c89a69420fade5ce93d16c36faae
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
# bxSlider Rails Gem - v4.2.
|
1
|
+
# bxSlider Rails Gem - v4.2.4
|
2
2
|
|
3
|
-
jQuery bxSlider v4.2.
|
3
|
+
jQuery bxSlider v4.2.4 - http://bxslider.com
|
4
4
|
|
5
5
|
bxSlider Author: Steven Wanderski, Copyright 2011
|
6
6
|
bxslider-rails Author: Mauricio Natanael Ferreira.
|
7
7
|
|
8
8
|
### Extra info
|
9
9
|
|
10
|
-
bxSlider 4.2.
|
10
|
+
bxSlider 4.2.4 == bxslider-rails (4.2.4)
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -1,1543 +1,1589 @@
|
|
1
|
-
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
* Copyright 2014, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com
|
1
|
+
/**
|
2
|
+
* bxSlider v4.2.4
|
3
|
+
* Copyright 2013-2015 Steven Wanderski
|
6
4
|
* Written while drinking Belgian ales and listening to jazz
|
7
|
-
|
8
|
-
*
|
9
|
-
|
10
|
-
|
11
|
-
;(function($){
|
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
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
5
|
+
|
6
|
+
* Licensed under MIT (http://opensource.org/licenses/MIT)
|
7
|
+
*/
|
8
|
+
|
9
|
+
;(function($) {
|
10
|
+
|
11
|
+
var defaults = {
|
12
|
+
|
13
|
+
// GENERAL
|
14
|
+
mode: 'horizontal',
|
15
|
+
slideSelector: '',
|
16
|
+
infiniteLoop: true,
|
17
|
+
hideControlOnEnd: false,
|
18
|
+
speed: 500,
|
19
|
+
easing: null,
|
20
|
+
slideMargin: 0,
|
21
|
+
startSlide: 0,
|
22
|
+
randomStart: false,
|
23
|
+
captions: false,
|
24
|
+
ticker: false,
|
25
|
+
tickerHover: false,
|
26
|
+
adaptiveHeight: false,
|
27
|
+
adaptiveHeightSpeed: 500,
|
28
|
+
video: false,
|
29
|
+
useCSS: true,
|
30
|
+
preloadImages: 'visible',
|
31
|
+
responsive: true,
|
32
|
+
slideZIndex: 50,
|
33
|
+
wrapperClass: 'bx-wrapper',
|
34
|
+
|
35
|
+
// TOUCH
|
36
|
+
touchEnabled: true,
|
37
|
+
swipeThreshold: 50,
|
38
|
+
oneToOneTouch: true,
|
39
|
+
preventDefaultSwipeX: true,
|
40
|
+
preventDefaultSwipeY: false,
|
41
|
+
|
42
|
+
// ACCESSIBILITY
|
43
|
+
ariaLive: true,
|
44
|
+
ariaHidden: true,
|
45
|
+
|
46
|
+
// KEYBOARD
|
47
|
+
keyboardEnabled: false,
|
48
|
+
|
49
|
+
// PAGER
|
50
|
+
pager: true,
|
51
|
+
pagerType: 'full',
|
52
|
+
pagerShortSeparator: ' / ',
|
53
|
+
pagerSelector: null,
|
54
|
+
buildPager: null,
|
55
|
+
pagerCustom: null,
|
56
|
+
|
57
|
+
// CONTROLS
|
58
|
+
controls: true,
|
59
|
+
nextText: 'Next',
|
60
|
+
prevText: 'Prev',
|
61
|
+
nextSelector: null,
|
62
|
+
prevSelector: null,
|
63
|
+
autoControls: false,
|
64
|
+
startText: 'Start',
|
65
|
+
stopText: 'Stop',
|
66
|
+
autoControlsCombine: false,
|
67
|
+
autoControlsSelector: null,
|
68
|
+
|
69
|
+
// AUTO
|
70
|
+
auto: false,
|
71
|
+
pause: 4000,
|
72
|
+
autoStart: true,
|
73
|
+
autoDirection: 'next',
|
74
|
+
stopAutoOnClick: false,
|
75
|
+
autoHover: false,
|
76
|
+
autoDelay: 0,
|
77
|
+
autoSlideForOnePage: false,
|
78
|
+
|
79
|
+
// CAROUSEL
|
80
|
+
minSlides: 1,
|
81
|
+
maxSlides: 1,
|
82
|
+
moveSlides: 0,
|
83
|
+
slideWidth: 0,
|
84
|
+
shrinkItems: false,
|
85
|
+
|
86
|
+
// CALLBACKS
|
87
|
+
onSliderLoad: function() { return true; },
|
88
|
+
onSlideBefore: function() { return true; },
|
89
|
+
onSlideAfter: function() { return true; },
|
90
|
+
onSlideNext: function() { return true; },
|
91
|
+
onSlidePrev: function() { return true; },
|
92
|
+
onSliderResize: function() { return true; }
|
93
|
+
};
|
94
|
+
|
95
|
+
$.fn.bxSlider = function(options) {
|
96
|
+
|
97
|
+
if (this.length === 0) {
|
98
|
+
return this;
|
99
|
+
}
|
100
|
+
|
101
|
+
// support multiple elements
|
102
|
+
if (this.length > 1) {
|
103
|
+
this.each(function() {
|
104
|
+
$(this).bxSlider(options);
|
105
|
+
});
|
106
|
+
return this;
|
107
|
+
}
|
108
|
+
|
109
|
+
// create a namespace to be used throughout the plugin
|
110
|
+
var slider = {},
|
111
|
+
// set a reference to our slider element
|
112
|
+
el = this,
|
113
|
+
// get the original window dimens (thanks a lot IE)
|
114
|
+
windowWidth = $(window).width(),
|
115
|
+
windowHeight = $(window).height();
|
116
|
+
|
117
|
+
// Return if slider is already initialized
|
118
|
+
if ($(el).data('bxSlider')) { return; }
|
119
|
+
|
120
|
+
/**
|
121
|
+
* ===================================================================================
|
122
|
+
* = PRIVATE FUNCTIONS
|
123
|
+
* ===================================================================================
|
124
|
+
*/
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Initializes namespace settings to be used throughout plugin
|
128
|
+
*/
|
129
|
+
var init = function() {
|
130
|
+
// Return if slider is already initialized
|
131
|
+
if ($(el).data('bxSlider')) { return; }
|
132
|
+
// merge user-supplied options with the defaults
|
133
|
+
slider.settings = $.extend({}, defaults, options);
|
134
|
+
// parse slideWidth setting
|
135
|
+
slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
|
136
|
+
// store the original children
|
137
|
+
slider.children = el.children(slider.settings.slideSelector);
|
138
|
+
// check if actual number of slides is less than minSlides / maxSlides
|
139
|
+
if (slider.children.length < slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; }
|
140
|
+
if (slider.children.length < slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; }
|
141
|
+
// if random start, set the startSlide setting to random number
|
142
|
+
if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); }
|
143
|
+
// store active slide information
|
144
|
+
slider.active = { index: slider.settings.startSlide };
|
145
|
+
// store if the slider is in carousel mode (displaying / moving multiple slides)
|
146
|
+
slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1 ? true : false;
|
147
|
+
// if carousel, force preloadImages = 'all'
|
148
|
+
if (slider.carousel) { slider.settings.preloadImages = 'all'; }
|
149
|
+
// calculate the min / max width thresholds based on min / max number of slides
|
150
|
+
// used to setup and update carousel slides dimensions
|
151
|
+
slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
|
152
|
+
slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
|
153
|
+
// store the current state of the slider (if currently animating, working is true)
|
154
|
+
slider.working = false;
|
155
|
+
// initialize the controls object
|
156
|
+
slider.controls = {};
|
157
|
+
// initialize an auto interval
|
158
|
+
slider.interval = null;
|
159
|
+
// determine which property to use for transitions
|
160
|
+
slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left';
|
161
|
+
// determine if hardware acceleration can be used
|
162
|
+
slider.usingCSS = slider.settings.useCSS && slider.settings.mode !== 'fade' && (function() {
|
163
|
+
// create our test div element
|
164
|
+
var div = document.createElement('div'),
|
165
|
+
// css transition properties
|
166
|
+
props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
|
167
|
+
// test for each property
|
168
|
+
for (var i = 0; i < props.length; i++) {
|
169
|
+
if (div.style[props[i]] !== undefined) {
|
170
|
+
slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
|
171
|
+
slider.animProp = '-' + slider.cssPrefix + '-transform';
|
172
|
+
return true;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
return false;
|
176
|
+
}());
|
177
|
+
// if vertical mode always make maxSlides and minSlides equal
|
178
|
+
if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; }
|
179
|
+
// save original style data
|
180
|
+
el.data('origStyle', el.attr('style'));
|
181
|
+
el.children(slider.settings.slideSelector).each(function() {
|
182
|
+
$(this).data('origStyle', $(this).attr('style'));
|
183
|
+
});
|
184
|
+
|
185
|
+
// perform all DOM / CSS modifications
|
186
|
+
setup();
|
187
|
+
};
|
188
|
+
|
189
|
+
/**
|
190
|
+
* Performs all DOM and CSS modifications
|
191
|
+
*/
|
192
|
+
var setup = function() {
|
193
|
+
var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible)
|
194
|
+
|
195
|
+
// wrap el in a wrapper
|
196
|
+
el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>');
|
197
|
+
// store a namespace reference to .bx-viewport
|
198
|
+
slider.viewport = el.parent();
|
199
|
+
|
200
|
+
// add aria-live if the setting is enabled and ticker mode is disabled
|
201
|
+
if (slider.settings.ariaLive && !slider.settings.ticker) {
|
202
|
+
slider.viewport.attr('aria-live', 'polite');
|
203
|
+
}
|
204
|
+
// add a loading div to display while images are loading
|
205
|
+
slider.loader = $('<div class="bx-loading" />');
|
206
|
+
slider.viewport.prepend(slider.loader);
|
207
|
+
// set el to a massive width, to hold any needed slides
|
208
|
+
// also strip any margin and padding from el
|
209
|
+
el.css({
|
210
|
+
width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto',
|
211
|
+
position: 'relative'
|
212
|
+
});
|
213
|
+
// if using CSS, add the easing property
|
214
|
+
if (slider.usingCSS && slider.settings.easing) {
|
215
|
+
el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
|
216
|
+
// if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
|
217
|
+
} else if (!slider.settings.easing) {
|
218
|
+
slider.settings.easing = 'swing';
|
219
|
+
}
|
220
|
+
// make modifications to the viewport (.bx-viewport)
|
221
|
+
slider.viewport.css({
|
222
|
+
width: '100%',
|
223
|
+
overflow: 'hidden',
|
224
|
+
position: 'relative'
|
225
|
+
});
|
226
|
+
slider.viewport.parent().css({
|
227
|
+
maxWidth: getViewportMaxWidth()
|
228
|
+
});
|
229
|
+
// make modification to the wrapper (.bx-wrapper)
|
230
|
+
if (!slider.settings.pager && !slider.settings.controls) {
|
231
|
+
slider.viewport.parent().css({
|
232
|
+
margin: '0 auto 0px'
|
233
|
+
});
|
234
|
+
}
|
235
|
+
// apply css to all slider children
|
236
|
+
slider.children.css({
|
237
|
+
float: slider.settings.mode === 'horizontal' ? 'left' : 'none',
|
238
|
+
listStyle: 'none',
|
239
|
+
position: 'relative'
|
240
|
+
});
|
241
|
+
// apply the calculated width after the float is applied to prevent scrollbar interference
|
242
|
+
slider.children.css('width', getSlideWidth());
|
243
|
+
// if slideMargin is supplied, add the css
|
244
|
+
if (slider.settings.mode === 'horizontal' && slider.settings.slideMargin > 0) { slider.children.css('marginRight', slider.settings.slideMargin); }
|
245
|
+
if (slider.settings.mode === 'vertical' && slider.settings.slideMargin > 0) { slider.children.css('marginBottom', slider.settings.slideMargin); }
|
246
|
+
// if "fade" mode, add positioning and z-index CSS
|
247
|
+
if (slider.settings.mode === 'fade') {
|
248
|
+
slider.children.css({
|
249
|
+
position: 'absolute',
|
250
|
+
zIndex: 0,
|
251
|
+
display: 'none'
|
252
|
+
});
|
253
|
+
// prepare the z-index on the showing element
|
254
|
+
slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
|
255
|
+
}
|
256
|
+
// create an element to contain all slider controls (pager, start / stop, etc)
|
257
|
+
slider.controls.el = $('<div class="bx-controls" />');
|
258
|
+
// if captions are requested, add them
|
259
|
+
if (slider.settings.captions) { appendCaptions(); }
|
260
|
+
// check if startSlide is last slide
|
261
|
+
slider.active.last = slider.settings.startSlide === getPagerQty() - 1;
|
262
|
+
// if video is true, set up the fitVids plugin
|
263
|
+
if (slider.settings.video) { el.fitVids(); }
|
264
|
+
if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { preloadSelector = slider.children; }
|
265
|
+
// only check for control addition if not in "ticker" mode
|
266
|
+
if (!slider.settings.ticker) {
|
267
|
+
// if controls are requested, add them
|
268
|
+
if (slider.settings.controls) { appendControls(); }
|
269
|
+
// if auto is true, and auto controls are requested, add them
|
270
|
+
if (slider.settings.auto && slider.settings.autoControls) { appendControlsAuto(); }
|
271
|
+
// if pager is requested, add it
|
272
|
+
if (slider.settings.pager) { appendPager(); }
|
273
|
+
// if any control option is requested, add the controls wrapper
|
274
|
+
if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); }
|
275
|
+
// if ticker mode, do not allow a pager
|
276
|
+
} else {
|
277
|
+
slider.settings.pager = false;
|
278
|
+
}
|
279
|
+
loadElements(preloadSelector, start);
|
280
|
+
};
|
281
|
+
|
282
|
+
var loadElements = function(selector, callback) {
|
283
|
+
var total = selector.find('img:not([src=""]), iframe').length,
|
284
|
+
count = 0;
|
285
|
+
if (total === 0) {
|
286
|
+
callback();
|
287
|
+
return;
|
288
|
+
}
|
289
|
+
selector.find('img:not([src=""]), iframe').each(function() {
|
290
|
+
$(this).one('load error', function() {
|
291
|
+
if (++count === total) { callback(); }
|
292
|
+
}).each(function() {
|
293
|
+
if (this.complete) { $(this).load(); }
|
294
|
+
});
|
295
|
+
});
|
296
|
+
};
|
297
|
+
|
298
|
+
/**
|
299
|
+
* Start the slider
|
300
|
+
*/
|
301
|
+
var start = function() {
|
302
|
+
// if infinite loop, prepare additional slides
|
303
|
+
if (slider.settings.infiniteLoop && slider.settings.mode !== 'fade' && !slider.settings.ticker) {
|
304
|
+
var slice = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides,
|
305
|
+
sliceAppend = slider.children.slice(0, slice).clone(true).addClass('bx-clone'),
|
306
|
+
slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone');
|
307
|
+
if (slider.settings.ariaHidden) {
|
308
|
+
sliceAppend.attr('aria-hidden', true);
|
309
|
+
slicePrepend.attr('aria-hidden', true);
|
310
|
+
}
|
311
|
+
el.append(sliceAppend).prepend(slicePrepend);
|
312
|
+
}
|
313
|
+
// remove the loading DOM element
|
314
|
+
slider.loader.remove();
|
315
|
+
// set the left / top position of "el"
|
316
|
+
setSlidePosition();
|
317
|
+
// if "vertical" mode, always use adaptiveHeight to prevent odd behavior
|
318
|
+
if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; }
|
319
|
+
// set the viewport height
|
320
|
+
slider.viewport.height(getViewportHeight());
|
321
|
+
// make sure everything is positioned just right (same as a window resize)
|
322
|
+
el.redrawSlider();
|
323
|
+
// onSliderLoad callback
|
324
|
+
slider.settings.onSliderLoad.call(el, slider.active.index);
|
325
|
+
// slider has been fully initialized
|
326
|
+
slider.initialized = true;
|
327
|
+
// bind the resize call to the window
|
328
|
+
if (slider.settings.responsive) { $(window).bind('resize', resizeWindow); }
|
329
|
+
// if auto is true and has more than 1 page, start the show
|
330
|
+
if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) { initAuto(); }
|
331
|
+
// if ticker is true, start the ticker
|
332
|
+
if (slider.settings.ticker) { initTicker(); }
|
333
|
+
// if pager is requested, make the appropriate pager link active
|
334
|
+
if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); }
|
335
|
+
// check for any updates to the controls (like hideControlOnEnd updates)
|
336
|
+
if (slider.settings.controls) { updateDirectionControls(); }
|
337
|
+
// if touchEnabled is true, setup the touch events
|
338
|
+
if (slider.settings.touchEnabled && !slider.settings.ticker) { initTouch(); }
|
339
|
+
// if keyboardEnabled is true, setup the keyboard events
|
340
|
+
if (slider.settings.keyboardEnabled && !slider.settings.ticker) {
|
341
|
+
$(document).keydown(keyPress);
|
342
|
+
}
|
343
|
+
};
|
344
|
+
|
345
|
+
/**
|
346
|
+
* Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
|
347
|
+
*/
|
348
|
+
var getViewportHeight = function() {
|
349
|
+
var height = el.outerHeight(),
|
350
|
+
currentIndex = null,
|
351
|
+
// first determine which children (slides) should be used in our height calculation
|
352
|
+
children = $();
|
353
|
+
// if mode is not "vertical" and adaptiveHeight is false, include all children
|
354
|
+
if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) {
|
355
|
+
children = slider.children;
|
356
|
+
} else {
|
357
|
+
// if not carousel, return the single active child
|
358
|
+
if (!slider.carousel) {
|
359
|
+
children = slider.children.eq(slider.active.index);
|
360
|
+
// if carousel, return a slice of children
|
361
|
+
} else {
|
362
|
+
// get the individual slide index
|
363
|
+
currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy();
|
364
|
+
// add the current slide to the children
|
365
|
+
children = slider.children.eq(currentIndex);
|
366
|
+
// cycle through the remaining "showing" slides
|
367
|
+
for (var i = 1; i <= slider.settings.maxSlides - 1; i++) {
|
368
|
+
// if looped back to the start
|
369
|
+
if (currentIndex + i >= slider.children.length) {
|
370
|
+
children = children.add(slider.children.eq(currentIndex + i - slider.children.length));
|
371
|
+
} else {
|
372
|
+
children = children.add(slider.children.eq(currentIndex + i));
|
373
|
+
}
|
374
|
+
}
|
375
|
+
}
|
376
|
+
}
|
377
|
+
// if "vertical" mode, calculate the sum of the heights of the children
|
378
|
+
if (slider.settings.mode === 'vertical') {
|
379
|
+
children.each(function(index) {
|
380
|
+
height += $(this).outerHeight();
|
381
|
+
});
|
382
|
+
// add user-supplied margins
|
383
|
+
if (slider.settings.slideMargin > 0) {
|
384
|
+
height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
|
385
|
+
}
|
386
|
+
// if not "vertical" mode, calculate the max height of the children
|
387
|
+
} else {
|
388
|
+
height = Math.max.apply(Math, children.map(function() {
|
389
|
+
return $(this).outerHeight(false);
|
390
|
+
}).get());
|
391
|
+
}
|
392
|
+
|
393
|
+
if (slider.viewport.css('box-sizing') === 'border-box') {
|
394
|
+
height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
|
395
|
+
parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
|
396
|
+
} else if (slider.viewport.css('box-sizing') === 'padding-box') {
|
397
|
+
height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
|
398
|
+
}
|
399
|
+
|
400
|
+
return height;
|
401
|
+
};
|
402
|
+
|
403
|
+
/**
|
404
|
+
* Returns the calculated width to be used for the outer wrapper / viewport
|
405
|
+
*/
|
406
|
+
var getViewportMaxWidth = function() {
|
407
|
+
var width = '100%';
|
408
|
+
if (slider.settings.slideWidth > 0) {
|
409
|
+
if (slider.settings.mode === 'horizontal') {
|
410
|
+
width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
|
411
|
+
} else {
|
412
|
+
width = slider.settings.slideWidth;
|
413
|
+
}
|
414
|
+
}
|
415
|
+
return width;
|
416
|
+
};
|
417
|
+
|
418
|
+
/**
|
419
|
+
* Returns the calculated width to be applied to each slide
|
420
|
+
*/
|
421
|
+
var getSlideWidth = function() {
|
422
|
+
var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width
|
423
|
+
wrapWidth = slider.viewport.width(); // get the current viewport width
|
424
|
+
// if slide width was not supplied, or is larger than the viewport use the viewport width
|
425
|
+
if (slider.settings.slideWidth === 0 ||
|
426
|
+
(slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
|
427
|
+
slider.settings.mode === 'vertical') {
|
428
|
+
newElWidth = wrapWidth;
|
429
|
+
// if carousel, use the thresholds to determine the width
|
430
|
+
} else if (slider.settings.maxSlides > 1 && slider.settings.mode === 'horizontal') {
|
431
|
+
if (wrapWidth > slider.maxThreshold) {
|
432
|
+
return newElWidth;
|
433
|
+
} else if (wrapWidth < slider.minThreshold) {
|
434
|
+
newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
|
435
|
+
} else if (slider.settings.shrinkItems) {
|
436
|
+
newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin);
|
437
|
+
}
|
438
|
+
}
|
439
|
+
return newElWidth;
|
440
|
+
};
|
441
|
+
|
442
|
+
/**
|
443
|
+
* Returns the number of slides currently visible in the viewport (includes partially visible slides)
|
444
|
+
*/
|
445
|
+
var getNumberSlidesShowing = function() {
|
446
|
+
var slidesShowing = 1,
|
447
|
+
childWidth = null;
|
448
|
+
if (slider.settings.mode === 'horizontal' && slider.settings.slideWidth > 0) {
|
449
|
+
// if viewport is smaller than minThreshold, return minSlides
|
450
|
+
if (slider.viewport.width() < slider.minThreshold) {
|
451
|
+
slidesShowing = slider.settings.minSlides;
|
452
|
+
// if viewport is larger than maxThreshold, return maxSlides
|
453
|
+
} else if (slider.viewport.width() > slider.maxThreshold) {
|
454
|
+
slidesShowing = slider.settings.maxSlides;
|
455
|
+
// if viewport is between min / max thresholds, divide viewport width by first child width
|
456
|
+
} else {
|
457
|
+
childWidth = slider.children.first().width() + slider.settings.slideMargin;
|
458
|
+
slidesShowing = Math.floor((slider.viewport.width() +
|
459
|
+
slider.settings.slideMargin) / childWidth);
|
460
|
+
}
|
461
|
+
// if "vertical" mode, slides showing will always be minSlides
|
462
|
+
} else if (slider.settings.mode === 'vertical') {
|
463
|
+
slidesShowing = slider.settings.minSlides;
|
464
|
+
}
|
465
|
+
return slidesShowing;
|
466
|
+
};
|
467
|
+
|
468
|
+
/**
|
469
|
+
* Returns the number of pages (one full viewport of slides is one "page")
|
470
|
+
*/
|
471
|
+
var getPagerQty = function() {
|
472
|
+
var pagerQty = 0,
|
473
|
+
breakPoint = 0,
|
474
|
+
counter = 0;
|
475
|
+
// if moveSlides is specified by the user
|
476
|
+
if (slider.settings.moveSlides > 0) {
|
477
|
+
if (slider.settings.infiniteLoop) {
|
478
|
+
pagerQty = Math.ceil(slider.children.length / getMoveBy());
|
479
|
+
} else {
|
480
|
+
// when breakpoint goes above children length, counter is the number of pages
|
481
|
+
while (breakPoint < slider.children.length) {
|
482
|
+
++pagerQty;
|
483
|
+
breakPoint = counter + getNumberSlidesShowing();
|
484
|
+
counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
|
485
|
+
}
|
486
|
+
}
|
487
|
+
// if moveSlides is 0 (auto) divide children length by sides showing, then round up
|
488
|
+
} else {
|
489
|
+
pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
|
490
|
+
}
|
491
|
+
return pagerQty;
|
492
|
+
};
|
493
|
+
|
494
|
+
/**
|
495
|
+
* Returns the number of individual slides by which to shift the slider
|
496
|
+
*/
|
497
|
+
var getMoveBy = function() {
|
498
|
+
// if moveSlides was set by the user and moveSlides is less than number of slides showing
|
499
|
+
if (slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()) {
|
500
|
+
return slider.settings.moveSlides;
|
501
|
+
}
|
502
|
+
// if moveSlides is 0 (auto)
|
503
|
+
return getNumberSlidesShowing();
|
504
|
+
};
|
505
|
+
|
506
|
+
/**
|
507
|
+
* Sets the slider's (el) left or top position
|
508
|
+
*/
|
509
|
+
var setSlidePosition = function() {
|
510
|
+
var position, lastChild, lastShowingIndex;
|
511
|
+
// if last slide, not infinite loop, and number of children is larger than specified maxSlides
|
512
|
+
if (slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop) {
|
513
|
+
if (slider.settings.mode === 'horizontal') {
|
514
|
+
// get the last child's position
|
515
|
+
lastChild = slider.children.last();
|
516
|
+
position = lastChild.position();
|
517
|
+
// set the left position
|
518
|
+
setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
|
519
|
+
} else if (slider.settings.mode === 'vertical') {
|
520
|
+
// get the last showing index's position
|
521
|
+
lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
522
|
+
position = slider.children.eq(lastShowingIndex).position();
|
523
|
+
// set the top position
|
524
|
+
setPositionProperty(-position.top, 'reset', 0);
|
525
|
+
}
|
526
|
+
// if not last slide
|
527
|
+
} else {
|
528
|
+
// get the position of the first showing slide
|
529
|
+
position = slider.children.eq(slider.active.index * getMoveBy()).position();
|
530
|
+
// check for last slide
|
531
|
+
if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; }
|
532
|
+
// set the respective position
|
533
|
+
if (position !== undefined) {
|
534
|
+
if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
|
535
|
+
else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
|
536
|
+
}
|
537
|
+
}
|
538
|
+
};
|
539
|
+
|
540
|
+
/**
|
541
|
+
* Sets the el's animating property position (which in turn will sometimes animate el).
|
542
|
+
* If using CSS, sets the transform property. If not using CSS, sets the top / left property.
|
543
|
+
*
|
544
|
+
* @param value (int)
|
545
|
+
* - the animating property's value
|
546
|
+
*
|
547
|
+
* @param type (string) 'slide', 'reset', 'ticker'
|
548
|
+
* - the type of instance for which the function is being
|
549
|
+
*
|
550
|
+
* @param duration (int)
|
551
|
+
* - the amount of time (in ms) the transition should occupy
|
552
|
+
*
|
553
|
+
* @param params (array) optional
|
554
|
+
* - an optional parameter containing any variables that need to be passed in
|
555
|
+
*/
|
556
|
+
var setPositionProperty = function(value, type, duration, params) {
|
557
|
+
var animateObj, propValue;
|
558
|
+
// use CSS transform
|
559
|
+
if (slider.usingCSS) {
|
560
|
+
// determine the translate3d value
|
561
|
+
propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
|
562
|
+
// add the CSS transition-duration
|
563
|
+
el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
|
564
|
+
if (type === 'slide') {
|
565
|
+
// set the property value
|
566
|
+
el.css(slider.animProp, propValue);
|
567
|
+
// bind a callback method - executes when CSS transition completes
|
568
|
+
el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
|
569
|
+
//make sure it's the correct one
|
570
|
+
if (!$(e.target).is(el)) { return; }
|
571
|
+
// unbind the callback
|
572
|
+
el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
|
573
|
+
updateAfterSlideTransition();
|
574
|
+
});
|
575
|
+
} else if (type === 'reset') {
|
576
|
+
el.css(slider.animProp, propValue);
|
577
|
+
} else if (type === 'ticker') {
|
578
|
+
// make the transition use 'linear'
|
579
|
+
el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
|
580
|
+
el.css(slider.animProp, propValue);
|
581
|
+
// bind a callback method - executes when CSS transition completes
|
582
|
+
el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
|
583
|
+
//make sure it's the correct one
|
584
|
+
if (!$(e.target).is(el)) { return; }
|
585
|
+
// unbind the callback
|
586
|
+
el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
|
587
|
+
// reset the position
|
588
|
+
setPositionProperty(params.resetValue, 'reset', 0);
|
589
|
+
// start the loop again
|
590
|
+
tickerLoop();
|
591
|
+
});
|
592
|
+
}
|
593
|
+
// use JS animate
|
594
|
+
} else {
|
595
|
+
animateObj = {};
|
596
|
+
animateObj[slider.animProp] = value;
|
597
|
+
if (type === 'slide') {
|
598
|
+
el.animate(animateObj, duration, slider.settings.easing, function() {
|
599
|
+
updateAfterSlideTransition();
|
600
|
+
});
|
601
|
+
} else if (type === 'reset') {
|
602
|
+
el.css(slider.animProp, value);
|
603
|
+
} else if (type === 'ticker') {
|
604
|
+
el.animate(animateObj, duration, 'linear', function() {
|
605
|
+
setPositionProperty(params.resetValue, 'reset', 0);
|
606
|
+
// run the recursive loop after animation
|
607
|
+
tickerLoop();
|
608
|
+
});
|
609
|
+
}
|
610
|
+
}
|
611
|
+
};
|
612
|
+
|
613
|
+
/**
|
614
|
+
* Populates the pager with proper amount of pages
|
615
|
+
*/
|
616
|
+
var populatePager = function() {
|
617
|
+
var pagerHtml = '',
|
618
|
+
linkContent = '',
|
619
|
+
pagerQty = getPagerQty();
|
620
|
+
// loop through each pager item
|
621
|
+
for (var i = 0; i < pagerQty; i++) {
|
622
|
+
linkContent = '';
|
623
|
+
// if a buildPager function is supplied, use it to get pager link value, else use index + 1
|
624
|
+
if (slider.settings.buildPager && $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) {
|
625
|
+
linkContent = slider.settings.buildPager(i);
|
626
|
+
slider.pagerEl.addClass('bx-custom-pager');
|
627
|
+
} else {
|
628
|
+
linkContent = i + 1;
|
629
|
+
slider.pagerEl.addClass('bx-default-pager');
|
630
|
+
}
|
631
|
+
// var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
|
632
|
+
// add the markup to the string
|
633
|
+
pagerHtml += '<div class="bx-pager-item"><a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>';
|
634
|
+
}
|
635
|
+
// populate the pager element with pager links
|
636
|
+
slider.pagerEl.html(pagerHtml);
|
637
|
+
};
|
638
|
+
|
639
|
+
/**
|
640
|
+
* Appends the pager to the controls element
|
641
|
+
*/
|
642
|
+
var appendPager = function() {
|
643
|
+
if (!slider.settings.pagerCustom) {
|
644
|
+
// create the pager DOM element
|
645
|
+
slider.pagerEl = $('<div class="bx-pager" />');
|
646
|
+
// if a pager selector was supplied, populate it with the pager
|
647
|
+
if (slider.settings.pagerSelector) {
|
648
|
+
$(slider.settings.pagerSelector).html(slider.pagerEl);
|
649
|
+
// if no pager selector was supplied, add it after the wrapper
|
650
|
+
} else {
|
651
|
+
slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
|
652
|
+
}
|
653
|
+
// populate the pager
|
654
|
+
populatePager();
|
655
|
+
} else {
|
656
|
+
slider.pagerEl = $(slider.settings.pagerCustom);
|
657
|
+
}
|
658
|
+
// assign the pager click binding
|
659
|
+
slider.pagerEl.on('click touchend', 'a', clickPagerBind);
|
660
|
+
};
|
661
|
+
|
662
|
+
/**
|
663
|
+
* Appends prev / next controls to the controls element
|
664
|
+
*/
|
665
|
+
var appendControls = function() {
|
666
|
+
slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>');
|
667
|
+
slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>');
|
668
|
+
// bind click actions to the controls
|
669
|
+
slider.controls.next.bind('click touchend', clickNextBind);
|
670
|
+
slider.controls.prev.bind('click touchend', clickPrevBind);
|
671
|
+
// if nextSelector was supplied, populate it
|
672
|
+
if (slider.settings.nextSelector) {
|
673
|
+
$(slider.settings.nextSelector).append(slider.controls.next);
|
674
|
+
}
|
675
|
+
// if prevSelector was supplied, populate it
|
676
|
+
if (slider.settings.prevSelector) {
|
677
|
+
$(slider.settings.prevSelector).append(slider.controls.prev);
|
678
|
+
}
|
679
|
+
// if no custom selectors were supplied
|
680
|
+
if (!slider.settings.nextSelector && !slider.settings.prevSelector) {
|
681
|
+
// add the controls to the DOM
|
682
|
+
slider.controls.directionEl = $('<div class="bx-controls-direction" />');
|
683
|
+
// add the control elements to the directionEl
|
684
|
+
slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
|
685
|
+
// slider.viewport.append(slider.controls.directionEl);
|
686
|
+
slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
|
687
|
+
}
|
688
|
+
};
|
689
|
+
|
690
|
+
/**
|
691
|
+
* Appends start / stop auto controls to the controls element
|
692
|
+
*/
|
693
|
+
var appendControlsAuto = function() {
|
694
|
+
slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>');
|
695
|
+
slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>');
|
696
|
+
// add the controls to the DOM
|
697
|
+
slider.controls.autoEl = $('<div class="bx-controls-auto" />');
|
698
|
+
// bind click actions to the controls
|
699
|
+
slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
|
700
|
+
slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
|
701
|
+
// if autoControlsCombine, insert only the "start" control
|
702
|
+
if (slider.settings.autoControlsCombine) {
|
703
|
+
slider.controls.autoEl.append(slider.controls.start);
|
704
|
+
// if autoControlsCombine is false, insert both controls
|
705
|
+
} else {
|
706
|
+
slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
|
707
|
+
}
|
708
|
+
// if auto controls selector was supplied, populate it with the controls
|
709
|
+
if (slider.settings.autoControlsSelector) {
|
710
|
+
$(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
|
711
|
+
// if auto controls selector was not supplied, add it after the wrapper
|
712
|
+
} else {
|
713
|
+
slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
|
714
|
+
}
|
715
|
+
// update the auto controls
|
716
|
+
updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
|
717
|
+
};
|
718
|
+
|
719
|
+
/**
|
720
|
+
* Appends image captions to the DOM
|
721
|
+
*/
|
722
|
+
var appendCaptions = function() {
|
723
|
+
// cycle through each child
|
724
|
+
slider.children.each(function(index) {
|
725
|
+
// get the image title attribute
|
726
|
+
var title = $(this).find('img:first').attr('title');
|
727
|
+
// append the caption
|
728
|
+
if (title !== undefined && ('' + title).length) {
|
729
|
+
$(this).append('<div class="bx-caption"><span>' + title + '</span></div>');
|
730
|
+
}
|
731
|
+
});
|
732
|
+
};
|
733
|
+
|
734
|
+
/**
|
735
|
+
* Click next binding
|
736
|
+
*
|
737
|
+
* @param e (event)
|
738
|
+
* - DOM event object
|
739
|
+
*/
|
740
|
+
var clickNextBind = function(e) {
|
741
|
+
e.preventDefault();
|
742
|
+
if (slider.controls.el.hasClass('disabled')) { return; }
|
743
|
+
// if auto show is running, stop it
|
744
|
+
if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
|
745
|
+
el.goToNextSlide();
|
746
|
+
};
|
747
|
+
|
748
|
+
/**
|
749
|
+
* Click prev binding
|
750
|
+
*
|
751
|
+
* @param e (event)
|
752
|
+
* - DOM event object
|
753
|
+
*/
|
754
|
+
var clickPrevBind = function(e) {
|
755
|
+
e.preventDefault();
|
756
|
+
if (slider.controls.el.hasClass('disabled')) { return; }
|
757
|
+
// if auto show is running, stop it
|
758
|
+
if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
|
759
|
+
el.goToPrevSlide();
|
760
|
+
};
|
761
|
+
|
762
|
+
/**
|
763
|
+
* Click start binding
|
764
|
+
*
|
765
|
+
* @param e (event)
|
766
|
+
* - DOM event object
|
767
|
+
*/
|
768
|
+
var clickStartBind = function(e) {
|
769
|
+
el.startAuto();
|
770
|
+
e.preventDefault();
|
771
|
+
};
|
772
|
+
|
773
|
+
/**
|
774
|
+
* Click stop binding
|
775
|
+
*
|
776
|
+
* @param e (event)
|
777
|
+
* - DOM event object
|
778
|
+
*/
|
779
|
+
var clickStopBind = function(e) {
|
780
|
+
el.stopAuto();
|
781
|
+
e.preventDefault();
|
782
|
+
};
|
783
|
+
|
784
|
+
/**
|
785
|
+
* Click pager binding
|
786
|
+
*
|
787
|
+
* @param e (event)
|
788
|
+
* - DOM event object
|
789
|
+
*/
|
790
|
+
var clickPagerBind = function(e) {
|
791
|
+
var pagerLink, pagerIndex;
|
792
|
+
e.preventDefault();
|
793
|
+
if (slider.controls.el.hasClass('disabled')) {
|
794
|
+
return;
|
795
|
+
}
|
796
|
+
// if auto show is running, stop it
|
797
|
+
if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
|
798
|
+
pagerLink = $(e.currentTarget);
|
799
|
+
if (pagerLink.attr('data-slide-index') !== undefined) {
|
800
|
+
pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
|
801
|
+
// if clicked pager link is not active, continue with the goToSlide call
|
802
|
+
if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); }
|
803
|
+
}
|
804
|
+
};
|
805
|
+
|
806
|
+
/**
|
807
|
+
* Updates the pager links with an active class
|
808
|
+
*
|
809
|
+
* @param slideIndex (int)
|
810
|
+
* - index of slide to make active
|
811
|
+
*/
|
812
|
+
var updatePagerActive = function(slideIndex) {
|
813
|
+
// if "short" pager type
|
814
|
+
var len = slider.children.length; // nb of children
|
815
|
+
if (slider.settings.pagerType === 'short') {
|
816
|
+
if (slider.settings.maxSlides > 1) {
|
817
|
+
len = Math.ceil(slider.children.length / slider.settings.maxSlides);
|
818
|
+
}
|
819
|
+
slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len);
|
820
|
+
return;
|
821
|
+
}
|
822
|
+
// remove all pager active classes
|
823
|
+
slider.pagerEl.find('a').removeClass('active');
|
824
|
+
// apply the active class for all pagers
|
825
|
+
slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
|
826
|
+
};
|
827
|
+
|
828
|
+
/**
|
829
|
+
* Performs needed actions after a slide transition
|
830
|
+
*/
|
831
|
+
var updateAfterSlideTransition = function() {
|
832
|
+
// if infinite loop is true
|
833
|
+
if (slider.settings.infiniteLoop) {
|
834
|
+
var position = '';
|
835
|
+
// first slide
|
836
|
+
if (slider.active.index === 0) {
|
837
|
+
// set the new position
|
838
|
+
position = slider.children.eq(0).position();
|
839
|
+
// carousel, last slide
|
840
|
+
} else if (slider.active.index === getPagerQty() - 1 && slider.carousel) {
|
841
|
+
position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
|
842
|
+
// last slide
|
843
|
+
} else if (slider.active.index === slider.children.length - 1) {
|
844
|
+
position = slider.children.eq(slider.children.length - 1).position();
|
845
|
+
}
|
846
|
+
if (position) {
|
847
|
+
if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
|
848
|
+
else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
|
849
|
+
}
|
850
|
+
}
|
851
|
+
// declare that the transition is complete
|
852
|
+
slider.working = false;
|
853
|
+
// onSlideAfter callback
|
854
|
+
slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
855
|
+
};
|
856
|
+
|
857
|
+
/**
|
858
|
+
* Updates the auto controls state (either active, or combined switch)
|
859
|
+
*
|
860
|
+
* @param state (string) "start", "stop"
|
861
|
+
* - the new state of the auto show
|
862
|
+
*/
|
863
|
+
var updateAutoControls = function(state) {
|
864
|
+
// if autoControlsCombine is true, replace the current control with the new state
|
865
|
+
if (slider.settings.autoControlsCombine) {
|
866
|
+
slider.controls.autoEl.html(slider.controls[state]);
|
867
|
+
// if autoControlsCombine is false, apply the "active" class to the appropriate control
|
868
|
+
} else {
|
869
|
+
slider.controls.autoEl.find('a').removeClass('active');
|
870
|
+
slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
|
871
|
+
}
|
872
|
+
};
|
873
|
+
|
874
|
+
/**
|
875
|
+
* Updates the direction controls (checks if either should be hidden)
|
876
|
+
*/
|
877
|
+
var updateDirectionControls = function() {
|
878
|
+
if (getPagerQty() === 1) {
|
879
|
+
slider.controls.prev.addClass('disabled');
|
880
|
+
slider.controls.next.addClass('disabled');
|
881
|
+
} else if (!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd) {
|
882
|
+
// if first slide
|
883
|
+
if (slider.active.index === 0) {
|
884
|
+
slider.controls.prev.addClass('disabled');
|
885
|
+
slider.controls.next.removeClass('disabled');
|
886
|
+
// if last slide
|
887
|
+
} else if (slider.active.index === getPagerQty() - 1) {
|
888
|
+
slider.controls.next.addClass('disabled');
|
889
|
+
slider.controls.prev.removeClass('disabled');
|
890
|
+
// if any slide in the middle
|
891
|
+
} else {
|
892
|
+
slider.controls.prev.removeClass('disabled');
|
893
|
+
slider.controls.next.removeClass('disabled');
|
894
|
+
}
|
895
|
+
}
|
896
|
+
};
|
897
|
+
|
898
|
+
/**
|
899
|
+
* Initializes the auto process
|
900
|
+
*/
|
901
|
+
var initAuto = function() {
|
902
|
+
// if autoDelay was supplied, launch the auto show using a setTimeout() call
|
903
|
+
if (slider.settings.autoDelay > 0) {
|
904
|
+
var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
|
905
|
+
// if autoDelay was not supplied, start the auto show normally
|
906
|
+
} else {
|
907
|
+
el.startAuto();
|
908
|
+
|
909
|
+
//add focus and blur events to ensure its running if timeout gets paused
|
910
|
+
$(window).focus(function() {
|
911
|
+
el.startAuto();
|
912
|
+
}).blur(function() {
|
913
|
+
el.stopAuto();
|
914
|
+
});
|
915
|
+
}
|
916
|
+
// if autoHover is requested
|
917
|
+
if (slider.settings.autoHover) {
|
918
|
+
// on el hover
|
919
|
+
el.hover(function() {
|
920
|
+
// if the auto show is currently playing (has an active interval)
|
921
|
+
if (slider.interval) {
|
922
|
+
// stop the auto show and pass true argument which will prevent control update
|
923
|
+
el.stopAuto(true);
|
924
|
+
// create a new autoPaused value which will be used by the relative "mouseout" event
|
925
|
+
slider.autoPaused = true;
|
926
|
+
}
|
927
|
+
}, function() {
|
928
|
+
// if the autoPaused value was created be the prior "mouseover" event
|
929
|
+
if (slider.autoPaused) {
|
930
|
+
// start the auto show and pass true argument which will prevent control update
|
931
|
+
el.startAuto(true);
|
932
|
+
// reset the autoPaused value
|
933
|
+
slider.autoPaused = null;
|
934
|
+
}
|
935
|
+
});
|
936
|
+
}
|
937
|
+
};
|
938
|
+
|
939
|
+
/**
|
940
|
+
* Initializes the ticker process
|
941
|
+
*/
|
942
|
+
var initTicker = function() {
|
943
|
+
var startPosition = 0,
|
944
|
+
position, transform, value, idx, ratio, property, newSpeed, totalDimens;
|
945
|
+
// if autoDirection is "next", append a clone of the entire slider
|
946
|
+
if (slider.settings.autoDirection === 'next') {
|
947
|
+
el.append(slider.children.clone().addClass('bx-clone'));
|
948
|
+
// if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
|
949
|
+
} else {
|
950
|
+
el.prepend(slider.children.clone().addClass('bx-clone'));
|
951
|
+
position = slider.children.first().position();
|
952
|
+
startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
|
953
|
+
}
|
954
|
+
setPositionProperty(startPosition, 'reset', 0);
|
955
|
+
// do not allow controls in ticker mode
|
956
|
+
slider.settings.pager = false;
|
957
|
+
slider.settings.controls = false;
|
958
|
+
slider.settings.autoControls = false;
|
959
|
+
// if autoHover is requested
|
960
|
+
if (slider.settings.tickerHover) {
|
961
|
+
if (slider.usingCSS) {
|
962
|
+
idx = slider.settings.mode === 'horizontal' ? 4 : 5;
|
963
|
+
slider.viewport.hover(function() {
|
964
|
+
transform = el.css('-' + slider.cssPrefix + '-transform');
|
965
|
+
value = parseFloat(transform.split(',')[idx]);
|
966
|
+
setPositionProperty(value, 'reset', 0);
|
967
|
+
}, function() {
|
968
|
+
totalDimens = 0;
|
969
|
+
slider.children.each(function(index) {
|
970
|
+
totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
|
971
|
+
});
|
972
|
+
// calculate the speed ratio (used to determine the new speed to finish the paused animation)
|
973
|
+
ratio = slider.settings.speed / totalDimens;
|
974
|
+
// determine which property to use
|
975
|
+
property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
|
976
|
+
// calculate the new speed
|
977
|
+
newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value))));
|
978
|
+
tickerLoop(newSpeed);
|
979
|
+
});
|
980
|
+
} else {
|
981
|
+
// on el hover
|
982
|
+
slider.viewport.hover(function() {
|
983
|
+
el.stop();
|
984
|
+
}, function() {
|
985
|
+
// calculate the total width of children (used to calculate the speed ratio)
|
986
|
+
totalDimens = 0;
|
987
|
+
slider.children.each(function(index) {
|
988
|
+
totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
|
989
|
+
});
|
990
|
+
// calculate the speed ratio (used to determine the new speed to finish the paused animation)
|
991
|
+
ratio = slider.settings.speed / totalDimens;
|
992
|
+
// determine which property to use
|
993
|
+
property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
|
994
|
+
// calculate the new speed
|
995
|
+
newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
|
996
|
+
tickerLoop(newSpeed);
|
997
|
+
});
|
998
|
+
}
|
999
|
+
}
|
1000
|
+
// start the ticker loop
|
1001
|
+
tickerLoop();
|
1002
|
+
};
|
1003
|
+
|
1004
|
+
/**
|
1005
|
+
* Runs a continuous loop, news ticker-style
|
1006
|
+
*/
|
1007
|
+
var tickerLoop = function(resumeSpeed) {
|
1008
|
+
var speed = resumeSpeed ? resumeSpeed : slider.settings.speed,
|
1009
|
+
position = {left: 0, top: 0},
|
1010
|
+
reset = {left: 0, top: 0},
|
1011
|
+
animateProperty, resetValue, params;
|
1012
|
+
|
1013
|
+
// if "next" animate left position to last child, then reset left to 0
|
1014
|
+
if (slider.settings.autoDirection === 'next') {
|
1015
|
+
position = el.find('.bx-clone').first().position();
|
1016
|
+
// if "prev" animate left position to 0, then reset left to first non-clone child
|
1017
|
+
} else {
|
1018
|
+
reset = slider.children.first().position();
|
1019
|
+
}
|
1020
|
+
animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
|
1021
|
+
resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top;
|
1022
|
+
params = {resetValue: resetValue};
|
1023
|
+
setPositionProperty(animateProperty, 'ticker', speed, params);
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
/**
|
1027
|
+
* Check if el is on screen
|
1028
|
+
*/
|
1029
|
+
var isOnScreen = function(el) {
|
1030
|
+
var win = $(window),
|
1031
|
+
viewport = {
|
1032
|
+
top: win.scrollTop(),
|
1033
|
+
left: win.scrollLeft()
|
1034
|
+
},
|
1035
|
+
bounds = el.offset();
|
1036
|
+
|
1037
|
+
viewport.right = viewport.left + win.width();
|
1038
|
+
viewport.bottom = viewport.top + win.height();
|
1039
|
+
bounds.right = bounds.left + el.outerWidth();
|
1040
|
+
bounds.bottom = bounds.top + el.outerHeight();
|
1041
|
+
|
1042
|
+
return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
|
1043
|
+
};
|
1044
|
+
|
1045
|
+
/**
|
1046
|
+
* Initializes keyboard events
|
1047
|
+
*/
|
1048
|
+
var keyPress = function(e) {
|
1049
|
+
var activeElementTag = document.activeElement.tagName.toLowerCase(),
|
1050
|
+
tagFilters = 'input|textarea',
|
1051
|
+
p = new RegExp(activeElementTag,['i']),
|
1052
|
+
result = p.exec(tagFilters);
|
1053
|
+
|
1054
|
+
if (result == null && isOnScreen(el)) {
|
1055
|
+
if (e.keyCode === 39) {
|
1056
|
+
clickNextBind(e);
|
1057
|
+
return false;
|
1058
|
+
} else if (e.keyCode === 37) {
|
1059
|
+
clickPrevBind(e);
|
1060
|
+
return false;
|
1061
|
+
}
|
1062
|
+
}
|
1063
|
+
};
|
1064
|
+
|
1065
|
+
/**
|
1066
|
+
* Initializes touch events
|
1067
|
+
*/
|
1068
|
+
var initTouch = function() {
|
1069
|
+
// initialize object to contain all touch values
|
1070
|
+
slider.touch = {
|
1071
|
+
start: {x: 0, y: 0},
|
1072
|
+
end: {x: 0, y: 0}
|
1073
|
+
};
|
1074
|
+
slider.viewport.bind('touchstart MSPointerDown pointerdown', onTouchStart);
|
1075
|
+
|
1076
|
+
//for browsers that have implemented pointer events and fire a click after
|
1077
|
+
//every pointerup regardless of whether pointerup is on same screen location as pointerdown or not
|
1078
|
+
slider.viewport.on('click', '.bxslider a', function(e) {
|
1079
|
+
if (slider.viewport.hasClass('click-disabled')) {
|
1080
|
+
e.preventDefault();
|
1081
|
+
slider.viewport.removeClass('click-disabled');
|
1082
|
+
}
|
1083
|
+
});
|
1084
|
+
};
|
1085
|
+
|
1086
|
+
/**
|
1087
|
+
* Event handler for "touchstart"
|
1088
|
+
*
|
1089
|
+
* @param e (event)
|
1090
|
+
* - DOM event object
|
1091
|
+
*/
|
1092
|
+
var onTouchStart = function(e) {
|
1093
|
+
//disable slider controls while user is interacting with slides to avoid slider freeze that happens on touch devices when a slide swipe happens immediately after interacting with slider controls
|
1094
|
+
slider.controls.el.addClass('disabled');
|
1095
|
+
|
1096
|
+
if (slider.working) {
|
1097
|
+
e.preventDefault();
|
1098
|
+
slider.controls.el.removeClass('disabled');
|
1099
|
+
} else {
|
1100
|
+
// record the original position when touch starts
|
1101
|
+
slider.touch.originalPos = el.position();
|
1102
|
+
var orig = e.originalEvent,
|
1103
|
+
touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig];
|
1104
|
+
// record the starting touch x, y coordinates
|
1105
|
+
slider.touch.start.x = touchPoints[0].pageX;
|
1106
|
+
slider.touch.start.y = touchPoints[0].pageY;
|
1107
|
+
|
1108
|
+
if (slider.viewport.get(0).setPointerCapture) {
|
1109
|
+
slider.pointerId = orig.pointerId;
|
1110
|
+
slider.viewport.get(0).setPointerCapture(slider.pointerId);
|
1111
|
+
}
|
1112
|
+
// bind a "touchmove" event to the viewport
|
1113
|
+
slider.viewport.bind('touchmove MSPointerMove pointermove', onTouchMove);
|
1114
|
+
// bind a "touchend" event to the viewport
|
1115
|
+
slider.viewport.bind('touchend MSPointerUp pointerup', onTouchEnd);
|
1116
|
+
slider.viewport.bind('MSPointerCancel pointercancel', onPointerCancel);
|
1117
|
+
}
|
1118
|
+
};
|
1119
|
+
|
1120
|
+
/**
|
1121
|
+
* Cancel Pointer for Windows Phone
|
1122
|
+
*
|
1123
|
+
* @param e (event)
|
1124
|
+
* - DOM event object
|
1125
|
+
*/
|
1126
|
+
var onPointerCancel = function(e) {
|
1127
|
+
/* onPointerCancel handler is needed to deal with situations when a touchend
|
1128
|
+
doesn't fire after a touchstart (this happens on windows phones only) */
|
1129
|
+
setPositionProperty(slider.touch.originalPos.left, 'reset', 0);
|
1130
|
+
|
1131
|
+
//remove handlers
|
1132
|
+
slider.controls.el.removeClass('disabled');
|
1133
|
+
slider.viewport.unbind('MSPointerCancel pointercancel', onPointerCancel);
|
1134
|
+
slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
|
1135
|
+
slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
|
1136
|
+
if (slider.viewport.get(0).releasePointerCapture) {
|
1137
|
+
slider.viewport.get(0).releasePointerCapture(slider.pointerId);
|
1138
|
+
}
|
1139
|
+
};
|
1140
|
+
|
1141
|
+
/**
|
1142
|
+
* Event handler for "touchmove"
|
1143
|
+
*
|
1144
|
+
* @param e (event)
|
1145
|
+
* - DOM event object
|
1146
|
+
*/
|
1147
|
+
var onTouchMove = function(e) {
|
1148
|
+
var orig = e.originalEvent,
|
1149
|
+
touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
|
1150
|
+
// if scrolling on y axis, do not prevent default
|
1151
|
+
xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x),
|
1152
|
+
yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y),
|
1153
|
+
value = 0,
|
1154
|
+
change = 0;
|
1155
|
+
|
1156
|
+
// x axis swipe
|
1157
|
+
if ((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX) {
|
1158
|
+
e.preventDefault();
|
1159
|
+
// y axis swipe
|
1160
|
+
} else if ((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY) {
|
1161
|
+
e.preventDefault();
|
1162
|
+
}
|
1163
|
+
if (slider.settings.mode !== 'fade' && slider.settings.oneToOneTouch) {
|
1164
|
+
// if horizontal, drag along x axis
|
1165
|
+
if (slider.settings.mode === 'horizontal') {
|
1166
|
+
change = touchPoints[0].pageX - slider.touch.start.x;
|
1167
|
+
value = slider.touch.originalPos.left + change;
|
1168
|
+
// if vertical, drag along y axis
|
1169
|
+
} else {
|
1170
|
+
change = touchPoints[0].pageY - slider.touch.start.y;
|
1171
|
+
value = slider.touch.originalPos.top + change;
|
1172
|
+
}
|
1173
|
+
setPositionProperty(value, 'reset', 0);
|
1174
|
+
}
|
1175
|
+
};
|
1176
|
+
|
1177
|
+
/**
|
1178
|
+
* Event handler for "touchend"
|
1179
|
+
*
|
1180
|
+
* @param e (event)
|
1181
|
+
* - DOM event object
|
1182
|
+
*/
|
1183
|
+
var onTouchEnd = function(e) {
|
1184
|
+
slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
|
1185
|
+
//enable slider controls as soon as user stops interacing with slides
|
1186
|
+
slider.controls.el.removeClass('disabled');
|
1187
|
+
var orig = e.originalEvent,
|
1188
|
+
touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
|
1189
|
+
value = 0,
|
1190
|
+
distance = 0;
|
1191
|
+
// record end x, y positions
|
1192
|
+
slider.touch.end.x = touchPoints[0].pageX;
|
1193
|
+
slider.touch.end.y = touchPoints[0].pageY;
|
1194
|
+
// if fade mode, check if absolute x distance clears the threshold
|
1195
|
+
if (slider.settings.mode === 'fade') {
|
1196
|
+
distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
|
1197
|
+
if (distance >= slider.settings.swipeThreshold) {
|
1198
|
+
if (slider.touch.start.x > slider.touch.end.x) {
|
1199
|
+
el.goToNextSlide();
|
1200
|
+
} else {
|
1201
|
+
el.goToPrevSlide();
|
1202
|
+
}
|
1203
|
+
el.stopAuto();
|
1204
|
+
}
|
1205
|
+
// not fade mode
|
1206
|
+
} else {
|
1207
|
+
// calculate distance and el's animate property
|
1208
|
+
if (slider.settings.mode === 'horizontal') {
|
1209
|
+
distance = slider.touch.end.x - slider.touch.start.x;
|
1210
|
+
value = slider.touch.originalPos.left;
|
1211
|
+
} else {
|
1212
|
+
distance = slider.touch.end.y - slider.touch.start.y;
|
1213
|
+
value = slider.touch.originalPos.top;
|
1214
|
+
}
|
1215
|
+
// if not infinite loop and first / last slide, do not attempt a slide transition
|
1216
|
+
if (!slider.settings.infiniteLoop && ((slider.active.index === 0 && distance > 0) || (slider.active.last && distance < 0))) {
|
1217
|
+
setPositionProperty(value, 'reset', 200);
|
1218
|
+
} else {
|
1219
|
+
// check if distance clears threshold
|
1220
|
+
if (Math.abs(distance) >= slider.settings.swipeThreshold) {
|
1221
|
+
if (distance < 0) {
|
1222
|
+
el.goToNextSlide();
|
1223
|
+
} else {
|
1224
|
+
el.goToPrevSlide();
|
1225
|
+
}
|
1226
|
+
el.stopAuto();
|
1227
|
+
} else {
|
1228
|
+
// el.animate(property, 200);
|
1229
|
+
setPositionProperty(value, 'reset', 200);
|
1230
|
+
}
|
1231
|
+
}
|
1232
|
+
}
|
1233
|
+
slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
|
1234
|
+
if (slider.viewport.get(0).releasePointerCapture) {
|
1235
|
+
slider.viewport.get(0).releasePointerCapture(slider.pointerId);
|
1236
|
+
}
|
1237
|
+
};
|
1238
|
+
|
1239
|
+
/**
|
1240
|
+
* Window resize event callback
|
1241
|
+
*/
|
1242
|
+
var resizeWindow = function(e) {
|
1243
|
+
// don't do anything if slider isn't initialized.
|
1244
|
+
if (!slider.initialized) { return; }
|
1245
|
+
// Delay if slider working.
|
1246
|
+
if (slider.working) {
|
1247
|
+
window.setTimeout(resizeWindow, 10);
|
1248
|
+
} else {
|
1249
|
+
// get the new window dimens (again, thank you IE)
|
1250
|
+
var windowWidthNew = $(window).width(),
|
1251
|
+
windowHeightNew = $(window).height();
|
1252
|
+
// make sure that it is a true window resize
|
1253
|
+
// *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
|
1254
|
+
// are resized. Can you just die already?*
|
1255
|
+
if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) {
|
1256
|
+
// set the new window dimens
|
1257
|
+
windowWidth = windowWidthNew;
|
1258
|
+
windowHeight = windowHeightNew;
|
1259
|
+
// update all dynamic elements
|
1260
|
+
el.redrawSlider();
|
1261
|
+
// Call user resize handler
|
1262
|
+
slider.settings.onSliderResize.call(el, slider.active.index);
|
1263
|
+
}
|
1264
|
+
}
|
1265
|
+
};
|
1266
|
+
|
1267
|
+
/**
|
1268
|
+
* Adds an aria-hidden=true attribute to each element
|
1269
|
+
*
|
1270
|
+
* @param startVisibleIndex (int)
|
1271
|
+
* - the first visible element's index
|
1272
|
+
*/
|
1273
|
+
var applyAriaHiddenAttributes = function(startVisibleIndex) {
|
1274
|
+
var numberOfSlidesShowing = getNumberSlidesShowing();
|
1275
|
+
// only apply attributes if the setting is enabled and not in ticker mode
|
1276
|
+
if (slider.settings.ariaHidden && !slider.settings.ticker) {
|
1277
|
+
// add aria-hidden=true to all elements
|
1278
|
+
slider.children.attr('aria-hidden', 'true');
|
1279
|
+
// get the visible elements and change to aria-hidden=false
|
1280
|
+
slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false');
|
1281
|
+
}
|
1282
|
+
};
|
1283
|
+
|
1284
|
+
/**
|
1285
|
+
* ===================================================================================
|
1286
|
+
* = PUBLIC FUNCTIONS
|
1287
|
+
* ===================================================================================
|
1288
|
+
*/
|
1289
|
+
|
1290
|
+
/**
|
1291
|
+
* Performs slide transition to the specified slide
|
1292
|
+
*
|
1293
|
+
* @param slideIndex (int)
|
1294
|
+
* - the destination slide's index (zero-based)
|
1295
|
+
*
|
1296
|
+
* @param direction (string)
|
1297
|
+
* - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
|
1298
|
+
*/
|
1299
|
+
el.goToSlide = function(slideIndex, direction) {
|
1300
|
+
// onSlideBefore, onSlideNext, onSlidePrev callbacks
|
1301
|
+
// Allow transition canceling based on returned value
|
1302
|
+
var performTransition = true,
|
1303
|
+
moveBy = 0,
|
1304
|
+
position = {left: 0, top: 0},
|
1305
|
+
lastChild = null,
|
1306
|
+
lastShowingIndex, eq, value, requestEl;
|
1307
|
+
|
1308
|
+
// if plugin is currently in motion, ignore request
|
1309
|
+
if (slider.working || slider.active.index === slideIndex) { return; }
|
1310
|
+
// declare that plugin is in motion
|
1311
|
+
slider.working = true;
|
1312
|
+
// store the old index
|
1313
|
+
slider.oldIndex = slider.active.index;
|
1314
|
+
// if slideIndex is less than zero, set active index to last child (this happens during infinite loop)
|
1315
|
+
if (slideIndex < 0) {
|
1316
|
+
slider.active.index = getPagerQty() - 1;
|
1317
|
+
// if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
|
1318
|
+
} else if (slideIndex >= getPagerQty()) {
|
1319
|
+
slider.active.index = 0;
|
1320
|
+
// set active index to requested slide
|
1321
|
+
} else {
|
1322
|
+
slider.active.index = slideIndex;
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1326
|
+
|
1327
|
+
if (typeof (performTransition) !== 'undefined' && !performTransition) {
|
1328
|
+
slider.active.index = slider.oldIndex; // restore old index
|
1329
|
+
slider.working = false; // is not in motion
|
1330
|
+
return;
|
1331
|
+
}
|
1332
|
+
if (direction === 'next') {
|
1333
|
+
// Prevent canceling in future functions or lack there-of from negating previous commands to cancel
|
1334
|
+
if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
|
1335
|
+
performTransition = false;
|
1336
|
+
}
|
1337
|
+
} else if (direction === 'prev') {
|
1338
|
+
// Prevent canceling in future functions or lack there-of from negating previous commands to cancel
|
1339
|
+
if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
|
1340
|
+
performTransition = false;
|
1341
|
+
}
|
1342
|
+
}
|
1343
|
+
|
1344
|
+
// If transitions canceled, reset and return
|
1345
|
+
if (typeof (performTransition) !== 'undefined' && !performTransition) {
|
1346
|
+
slider.active.index = slider.oldIndex; // restore old index
|
1347
|
+
slider.working = false; // is not in motion
|
1348
|
+
return;
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
// check if last slide
|
1352
|
+
slider.active.last = slider.active.index >= getPagerQty() - 1;
|
1353
|
+
// update the pager with active class
|
1354
|
+
if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); }
|
1355
|
+
// // check for direction control update
|
1356
|
+
if (slider.settings.controls) { updateDirectionControls(); }
|
1357
|
+
// if slider is set to mode: "fade"
|
1358
|
+
if (slider.settings.mode === 'fade') {
|
1359
|
+
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
1360
|
+
if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
|
1361
|
+
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
1362
|
+
}
|
1363
|
+
// fade out the visible child and reset its z-index value
|
1364
|
+
slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
|
1365
|
+
// fade in the newly requested slide
|
1366
|
+
slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() {
|
1367
|
+
$(this).css('zIndex', slider.settings.slideZIndex);
|
1368
|
+
updateAfterSlideTransition();
|
1369
|
+
});
|
1370
|
+
// slider mode is not "fade"
|
1371
|
+
} else {
|
1372
|
+
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
1373
|
+
if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
|
1374
|
+
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
1375
|
+
}
|
1376
|
+
// if carousel and not infinite loop
|
1377
|
+
if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) {
|
1378
|
+
if (slider.settings.mode === 'horizontal') {
|
1379
|
+
// get the last child position
|
1380
|
+
lastChild = slider.children.eq(slider.children.length - 1);
|
1381
|
+
position = lastChild.position();
|
1382
|
+
// calculate the position of the last slide
|
1383
|
+
moveBy = slider.viewport.width() - lastChild.outerWidth();
|
1384
|
+
} else {
|
1385
|
+
// get last showing index position
|
1386
|
+
lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
1387
|
+
position = slider.children.eq(lastShowingIndex).position();
|
1388
|
+
}
|
1389
|
+
// horizontal carousel, going previous while on first slide (infiniteLoop mode)
|
1390
|
+
} else if (slider.carousel && slider.active.last && direction === 'prev') {
|
1391
|
+
// get the last child position
|
1392
|
+
eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
|
1393
|
+
lastChild = el.children('.bx-clone').eq(eq);
|
1394
|
+
position = lastChild.position();
|
1395
|
+
// if infinite loop and "Next" is clicked on the last slide
|
1396
|
+
} else if (direction === 'next' && slider.active.index === 0) {
|
1397
|
+
// get the last clone position
|
1398
|
+
position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position();
|
1399
|
+
slider.active.last = false;
|
1400
|
+
// normal non-zero requests
|
1401
|
+
} else if (slideIndex >= 0) {
|
1402
|
+
requestEl = slideIndex * getMoveBy();
|
1403
|
+
position = slider.children.eq(requestEl).position();
|
1404
|
+
}
|
1405
|
+
|
1406
|
+
/* If the position doesn't exist
|
1407
|
+
* (e.g. if you destroy the slider on a next click),
|
1408
|
+
* it doesn't throw an error.
|
1409
|
+
*/
|
1410
|
+
if (typeof (position) !== undefined) {
|
1411
|
+
value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top;
|
1412
|
+
// plugin values to be animated
|
1413
|
+
setPositionProperty(value, 'slide', slider.settings.speed);
|
1414
|
+
}
|
1415
|
+
}
|
1416
|
+
if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
|
1417
|
+
};
|
1418
|
+
|
1419
|
+
/**
|
1420
|
+
* Transitions to the next slide in the show
|
1421
|
+
*/
|
1422
|
+
el.goToNextSlide = function() {
|
1423
|
+
// if infiniteLoop is false and last page is showing, disregard call
|
1424
|
+
if (!slider.settings.infiniteLoop && slider.active.last) { return; }
|
1425
|
+
var pagerIndex = parseInt(slider.active.index) + 1;
|
1426
|
+
el.goToSlide(pagerIndex, 'next');
|
1427
|
+
};
|
1428
|
+
|
1429
|
+
/**
|
1430
|
+
* Transitions to the prev slide in the show
|
1431
|
+
*/
|
1432
|
+
el.goToPrevSlide = function() {
|
1433
|
+
// if infiniteLoop is false and last page is showing, disregard call
|
1434
|
+
if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; }
|
1435
|
+
var pagerIndex = parseInt(slider.active.index) - 1;
|
1436
|
+
el.goToSlide(pagerIndex, 'prev');
|
1437
|
+
};
|
1438
|
+
|
1439
|
+
/**
|
1440
|
+
* Starts the auto show
|
1441
|
+
*
|
1442
|
+
* @param preventControlUpdate (boolean)
|
1443
|
+
* - if true, auto controls state will not be updated
|
1444
|
+
*/
|
1445
|
+
el.startAuto = function(preventControlUpdate) {
|
1446
|
+
// if an interval already exists, disregard call
|
1447
|
+
if (slider.interval) { return; }
|
1448
|
+
// create an interval
|
1449
|
+
slider.interval = setInterval(function() {
|
1450
|
+
if (slider.settings.autoDirection === 'next') {
|
1451
|
+
el.goToNextSlide();
|
1452
|
+
} else {
|
1453
|
+
el.goToPrevSlide();
|
1454
|
+
}
|
1455
|
+
}, slider.settings.pause);
|
1456
|
+
// if auto controls are displayed and preventControlUpdate is not true
|
1457
|
+
if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); }
|
1458
|
+
};
|
1459
|
+
|
1460
|
+
/**
|
1461
|
+
* Stops the auto show
|
1462
|
+
*
|
1463
|
+
* @param preventControlUpdate (boolean)
|
1464
|
+
* - if true, auto controls state will not be updated
|
1465
|
+
*/
|
1466
|
+
el.stopAuto = function(preventControlUpdate) {
|
1467
|
+
// if no interval exists, disregard call
|
1468
|
+
if (!slider.interval) { return; }
|
1469
|
+
// clear the interval
|
1470
|
+
clearInterval(slider.interval);
|
1471
|
+
slider.interval = null;
|
1472
|
+
// if auto controls are displayed and preventControlUpdate is not true
|
1473
|
+
if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); }
|
1474
|
+
};
|
1475
|
+
|
1476
|
+
/**
|
1477
|
+
* Returns current slide index (zero-based)
|
1478
|
+
*/
|
1479
|
+
el.getCurrentSlide = function() {
|
1480
|
+
return slider.active.index;
|
1481
|
+
};
|
1482
|
+
|
1483
|
+
/**
|
1484
|
+
* Returns current slide element
|
1485
|
+
*/
|
1486
|
+
el.getCurrentSlideElement = function() {
|
1487
|
+
return slider.children.eq(slider.active.index);
|
1488
|
+
};
|
1489
|
+
|
1490
|
+
/**
|
1491
|
+
* Returns a slide element
|
1492
|
+
* @param index (int)
|
1493
|
+
* - The index (zero-based) of the element you want returned.
|
1494
|
+
*/
|
1495
|
+
el.getSlideElement = function(index) {
|
1496
|
+
return slider.children.eq(index);
|
1497
|
+
};
|
1498
|
+
|
1499
|
+
/**
|
1500
|
+
* Returns number of slides in show
|
1501
|
+
*/
|
1502
|
+
el.getSlideCount = function() {
|
1503
|
+
return slider.children.length;
|
1504
|
+
};
|
1505
|
+
|
1506
|
+
/**
|
1507
|
+
* Return slider.working variable
|
1508
|
+
*/
|
1509
|
+
el.isWorking = function() {
|
1510
|
+
return slider.working;
|
1511
|
+
};
|
1512
|
+
|
1513
|
+
/**
|
1514
|
+
* Update all dynamic slider elements
|
1515
|
+
*/
|
1516
|
+
el.redrawSlider = function() {
|
1517
|
+
// resize all children in ratio to new screen size
|
1518
|
+
slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth());
|
1519
|
+
// adjust the height
|
1520
|
+
slider.viewport.css('height', getViewportHeight());
|
1521
|
+
// update the slide position
|
1522
|
+
if (!slider.settings.ticker) { setSlidePosition(); }
|
1523
|
+
// if active.last was true before the screen resize, we want
|
1524
|
+
// to keep it last no matter what screen size we end on
|
1525
|
+
if (slider.active.last) { slider.active.index = getPagerQty() - 1; }
|
1526
|
+
// if the active index (page) no longer exists due to the resize, simply set the index as last
|
1527
|
+
if (slider.active.index >= getPagerQty()) { slider.active.last = true; }
|
1528
|
+
// if a pager is being displayed and a custom pager is not being used, update it
|
1529
|
+
if (slider.settings.pager && !slider.settings.pagerCustom) {
|
1530
|
+
populatePager();
|
1531
|
+
updatePagerActive(slider.active.index);
|
1532
|
+
}
|
1533
|
+
if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
|
1534
|
+
};
|
1535
|
+
|
1536
|
+
/**
|
1537
|
+
* Destroy the current instance of the slider (revert everything back to original state)
|
1538
|
+
*/
|
1539
|
+
el.destroySlider = function() {
|
1540
|
+
// don't do anything if slider has already been destroyed
|
1541
|
+
if (!slider.initialized) { return; }
|
1542
|
+
slider.initialized = false;
|
1543
|
+
$('.bx-clone', this).remove();
|
1544
|
+
slider.children.each(function() {
|
1545
|
+
if ($(this).data('origStyle') !== undefined) {
|
1546
|
+
$(this).attr('style', $(this).data('origStyle'));
|
1547
|
+
} else {
|
1548
|
+
$(this).removeAttr('style');
|
1549
|
+
}
|
1550
|
+
});
|
1551
|
+
if ($(this).data('origStyle') !== undefined) {
|
1552
|
+
this.attr('style', $(this).data('origStyle'));
|
1553
|
+
} else {
|
1554
|
+
$(this).removeAttr('style');
|
1555
|
+
}
|
1556
|
+
$(this).unwrap().unwrap();
|
1557
|
+
if (slider.controls.el) { slider.controls.el.remove(); }
|
1558
|
+
if (slider.controls.next) { slider.controls.next.remove(); }
|
1559
|
+
if (slider.controls.prev) { slider.controls.prev.remove(); }
|
1560
|
+
if (slider.pagerEl && slider.settings.controls && !slider.settings.pagerCustom) { slider.pagerEl.remove(); }
|
1561
|
+
$('.bx-caption', this).remove();
|
1562
|
+
if (slider.controls.autoEl) { slider.controls.autoEl.remove(); }
|
1563
|
+
clearInterval(slider.interval);
|
1564
|
+
if (slider.settings.responsive) { $(window).unbind('resize', resizeWindow); }
|
1565
|
+
if (slider.settings.keyboardEnabled) { $(document).unbind('keydown', keyPress); }
|
1566
|
+
//remove self reference in data
|
1567
|
+
$(this).removeData('bxSlider');
|
1568
|
+
};
|
1569
|
+
|
1570
|
+
/**
|
1571
|
+
* Reload the slider (revert all DOM changes, and re-initialize)
|
1572
|
+
*/
|
1573
|
+
el.reloadSlider = function(settings) {
|
1574
|
+
if (settings !== undefined) { options = settings; }
|
1575
|
+
el.destroySlider();
|
1576
|
+
init();
|
1577
|
+
//store reference to self in order to access public functions later
|
1578
|
+
$(el).data('bxSlider', this);
|
1579
|
+
};
|
1580
|
+
|
1581
|
+
init();
|
1582
|
+
|
1583
|
+
$(el).data('bxSlider', this);
|
1584
|
+
|
1585
|
+
// returns the current jQuery object
|
1586
|
+
return this;
|
1587
|
+
};
|
1542
1588
|
|
1543
1589
|
})(jQuery);
|