-
Notifications
You must be signed in to change notification settings - Fork 0
/
slick-custom.js
151 lines (124 loc) · 5.2 KB
/
slick-custom.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
(function ($) {
// USE STRICT
"use strict";
/*[ Slick1 ]
===========================================================*/
var itemSlick1 = $('.slick1').find('.item-slick1');
var action1 = [];
var action2 = [];
var action3 = [];
var cap1Slide1 = [];
var cap2Slide1 = [];
var btnSlide1 = [];
for(var i=0; i<itemSlick1.length; i++) {
cap1Slide1[i] = $(itemSlick1[i]).find('.caption1-slide1');
cap2Slide1[i] = $(itemSlick1[i]).find('.caption2-slide1');
btnSlide1[i] = $(itemSlick1[i]).find('.wrap-btn-slide1');
}
$('.slick1').on('init', function(){
action1[0] = setTimeout(function(){
$(cap1Slide1[0]).addClass($(cap1Slide1[0]).data('appear') + ' visible-true');
},200);
action2[0] = setTimeout(function(){
$(cap2Slide1[0]).addClass($(cap2Slide1[0]).data('appear') + ' visible-true');
},1000);
action3[0] = setTimeout(function(){
$(btnSlide1[0]).addClass($(btnSlide1)[0].data('appear') + ' visible-true');
},1800);
});
$('.slick1').slick({
slidesToShow: 1,
slidesToScroll: 1,
fade: true,
dots: false,
appendDots: $('.wrap-slick1-dots'),
dotsClass:'slick1-dots',
infinite: true,
autoplay: true,
autoplaySpeed: 6000,
arrows: true,
appendArrows: $('.wrap-slick1'),
prevArrow:'<button class="arrow-slick1 prev-slick1"><i class="fa fa-angle-left" aria-hidden="true"></i></button>',
nextArrow:'<button class="arrow-slick1 next-slick1"><i class="fa fa-angle-right" aria-hidden="true"></i></button>',
});
$('.slick1').on('afterChange', function(event, slick, currentSlide){
for(var i=0; i<itemSlick1.length; i++) {
clearTimeout(action1[i]);
clearTimeout(action2[i]);
clearTimeout(action3[i]);
$(cap1Slide1[i]).removeClass($(cap1Slide1[i]).data('appear') + ' visible-true');
$(cap2Slide1[i]).removeClass($(cap2Slide1[i]).data('appear') + ' visible-true');
$(btnSlide1[i]).removeClass($(btnSlide1[i]).data('appear') + ' visible-true');
}
action1[currentSlide] = setTimeout(function(){
$(cap1Slide1[currentSlide]).addClass($(cap1Slide1[currentSlide]).data('appear') + ' visible-true');
},200);
action2[currentSlide] = setTimeout(function(){
$(cap2Slide1[currentSlide]).addClass($(cap2Slide1[currentSlide]).data('appear') + ' visible-true');
},1000);
action3[currentSlide] = setTimeout(function(){
$(btnSlide1[currentSlide]).addClass($(btnSlide1)[currentSlide].data('appear') + ' visible-true');
},1800);
});
/*[ Slick2 ]
===========================================================*/
$('.slick2').slick({
slidesToShow: 4,
slidesToScroll: 4,
infinite: true,
autoplay: false,
autoplaySpeed: 6000,
arrows: true,
appendArrows: $('.wrap-slick2'),
prevArrow:'<button class="arrow-slick2 prev-slick2"><i class="fa fa-angle-left" aria-hidden="true"></i></button>',
nextArrow:'<button class="arrow-slick2 next-slick2"><i class="fa fa-angle-right" aria-hidden="true"></i></button>',
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 4,
slidesToScroll: 4
}
},
{
breakpoint: 992,
settings: {
slidesToShow: 3,
slidesToScroll: 3
}
},
{
breakpoint: 768,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 576,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
/*[ Slick3 ]
===========================================================*/
$('.slick3').slick({
slidesToShow: 1,
slidesToScroll: 1,
fade: true,
dots: true,
appendDots: $('.wrap-slick3-dots'),
dotsClass:'slick3-dots',
infinite: true,
autoplay: false,
autoplaySpeed: 6000,
arrows: false,
customPaging: function(slick, index) {
var portrait = $(slick.$slides[index]).data('thumb');
return '<img src=" ' + portrait + ' "/><div class="slick3-dot-overlay"></div>';
},
});
})(jQuery);