Не работает слайдер slick.js
06.07.2020, 23:00. Показов 1684. Ответов 4
Не работает слайдер, не могу понять в чём причина
Примеры кода:
| HTML5 | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
| <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css2?family=Cardo:ital@1&family=Open+Sans:wght@700&family=Raleway:wght@300,400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css"/>
<link rel= "stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>ActiveBox</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<!--Header-->
<header class="header" id="header">
<div class="container">
<div class="header__iner">
<div class="header__logo">
<img src="img/ActiveBoxlogo.png" alt="">
</div>
<nav class="nav" id="nav">
<a href="#" class="nav__link" data-scroll="#features">Features</a>
<a href="#" class="nav__link" data-scroll="#works">Works</a>
<a href="#" class="nav__link" data-scroll="#team">Our Team</a>
<a href="#" class="nav__link" data-scroll="#reviews">Testimonials</a>
<a href="#" class="nav__link" data-scroll="#download">Download</a>
</nav>
<button class="burger" type="button" id="navToggle">
<span class="burger__item">Menu</span>
</button>
</div>
</div>
</header>
<!--Intro-->
<div class="intro" id="intro">
<div class="container">
<div class="intro__iner">
<h1 class="intro__title">Your Favorite One Page
Multi Purpose Template</h1>
<h2 class="intro__subtitle">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent commodo cursus magna
vel scelerisque nisl consectetur et.</h2>
<a class= "btn btn__red" href="#">Find Out More</a>
</div>
</div>
</div>
<!--Features -->
<div class="container" id="features">
<div class="feature">
<div class="feature__item">
<img class="feature__icon"src="img/feature/feature1.png" alt="">
<h4 class="feature__title">Easily Customised</h4>
<div class="feature__text">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nullam quis risus eget urna mollis ornare vel eu leo. Donec ullamcorper nulla non metus auct</div>
</div>
<div class="feature__item">
<img class="feature__icon"src="img/feature/feature2.png" alt="">
<h4 class="feature__title">Responsive REady</h4>
<div class="feature__text">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nullam quis risus eget urna mollis ornare vel eu leo. Donec ullamcorper nulla non metus auctor </div>
</div>
<div class="feature__item">
<img class="feature__icon"src="img/feature/feature3.png" alt="">
<h4 class="feature__title">Modern Design</h4>
<div class="feature__text">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nullam quis risus eget urna mollis ornare vel eu leo. Donec ullamcorper nulla non metus aucto </div>
</div>
<div class="feature__item">
<img class="feature__icon"src="img/feature/feature4.png" alt="">
<h4 class="feature__title">Clean Code</h4>
<div class="feature__text">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nullam quis risus eget urna mollis ornare vel eu leo. Donec ullamcorper nulla non metus auctor </div>
</div>
<div class="feature__item">
<img class="feature__icon"src="img/feature/feature5.png" alt="">
<h4 class="feature__title">Ready to Ship</h4>
<div class="feature__text">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nullam quis risus eget urna mollis ornare vel eu leo. Donec ullamcorper nulla non metus auctor </div>
</div>
<div class="feature__item">
<img class="feature__icon"src="img/feature/feature6.png" alt="">
<h4 class="feature__title">Download for Free</h4>
<div class="feature__text">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nullam quis risus eget urna mollis ornare vel eu leo. Donec ullamcorper nulla non metus aucto </div>
</div>
</div>
</div>
<!--Work-->
<div class="work" id="works">
<div class="work__item">
<img class="work__photo"src="img/work/work-1.jpg" alt="">
<div class="work__content">
<div class="work__title">Project Name</div>
<div class="work__text">User Interface Design</div>
</div>
</div>
<div class="work__item">
<img class="work__photo"src="img/work/work-2.jpg" alt="">
<div class="work__content">
<div class="work__title">Project Name</div>
<div class="work__text">User Interface Design</div>
</div>
</div>
<div class="work__item">
<img class="work__photo"src="img/work/work-3.jpg" alt="">
<div class="work__content">
<div class="work__title">Project Name</div>
<div class="work__text">User Interface Design</div>
</div>
</div>
<div class="work__item">
<img class="work__photo"src="img/work/work-4.jpg" alt="">
<div class="work__content">
<div class="work__title">Project Name</div>
<div class="work__text">User Interface Design</div>
</div>
</div>
<div class="work__item">
<img class="work__photo"src="img/work/work-5.jpg" alt="">
<div class="work__content">
<div class="work__title">Project Name</div>
<div class="work__text">User Interface Design</div>
</div>
</div>
<div class="work__item">
<img class="work__photo"src="img/work/work-6.jpg" alt="">
<div class="work__content">
<div class="work__title">Project Name</div>
<div class="work__text">User Interface Design</div>
</div>
</div>
<div class="work__item">
<img class="work__photo"src="img/work/work-7.jpg" alt="">
<div class="work__content">
<div class="work__title">Project Name</div>
<div class="work__text">User Interface Design</div>
</div>
</div>
<div class="work__item">
<img class="work__photo"src="img/work/work-8.jpg" alt="">
<div class="work__content">
<div class="work__title">Project Name</div>
<div class="work__text">User Interface Design</div>
</div>
</div>
</div>
<!--Team-->
<div class="team" id="team">
<div class="container">
<div class="team__inet">
<div class="team__item">
<img class="team__photo" src="img/team/Team1.jpg" alt="">
<div class="team__name">Ruth Woods</div>
<div class="team__prof">Founder, CEO</div>
<div class="team__text">
<p>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
</div>
<div class="social">
<a class="social__item" href="#">
<img src="img/facebook.svg" height="18" alt="">
</a>
<a class="social__item" href="#">
<img src="img/twitter.svg" height="18" alt="">
</a>
<a class="social__item" href="#">
<img src="img/linkedin.svg" height="18" alt="">
</a>
</div>
</div>
<div class="team__item">
<img class="team__photo" src="img/team/Team2.jpg" alt="">
<div class="team__name">Timothy Reed</div>
<div class="team__prof">Co-Founder, Developer</div>
<div class="team__text">
<p>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
</div>
<div class="social">
<a class="social__item" href="#">
<img src="img/facebook.svg" height="18" alt="">
</a>
<a class="social__item" href="#">
<img src="img/twitter.svg" height="18" alt="">
</a>
<a class="social__item" href="#">
<img src="img/linkedin.svg" height="18" alt="">
</a>
</div>
</div>
<div class="team__item">
<img class="team__photo" src="img/team/Team3.jpg" alt="">
<div class="team__name">Victoria Valdez</div>
<div class="team__prof">UI Designer</div>
<div class="team__text">
<p>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
</div>
<div class="social">
<a class="social__item" href="#">
<img src="img/facebook.svg" height="18" alt="">
</a>
<a class="social__item" href="#">
<img src="img/twitter.svg" height="18" alt="">
</a>
<a class="social__item" href="#">
<img src="img/linkedin.svg" height="18" alt="">
</a>
</div>
</div>
<div class="team__item">
<img class="team__photo" src="img/team/Team4.jpg" alt="">
<div class="team__name">Beverly Little</div>
<div class="team__prof">Data Scientist</div>
<div class="team__text">
<p>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
</div>
<div class="social">
<a class="social__item" href="#">
<img src="img/facebook.svg" height="18" alt="">
</a>
<a class="social__item" href="#">
<img src="img/twitter.svg" height="18" alt="">
</a>
<a class="social__item" href="#">
<img src="img/linkedin.svg" height="18" alt="">
</a>
</div>
</div>
</div><!--Team__iner-->
</div><!--container-->
</div><!--Team-->
<!--reviews-->
<div class="reviews" id="reviews">
<div class="container">
<div class="reviewsslider">
<div class="slick-item">
<div class="reviews__item">
<div class="reviews__photo">
<img class="reviews__img" src="img/reviews/review1.jpg" alt="">
</div>
<div class="reviews__content">
<div class="reviews__text">“Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Donec sed odio dui. Aenean eu leo quam...”</div>
<div class="reviews__author">Susan Sims, Interaction Designer at XYZ</div>
</div>
</div>
</div>
<div class="slick-item">
<div class="reviews__item">
<div class="reviews__photo">
<img class="reviews__img" src="img/reviews/review1.jpg" alt="">
</div>
<div class="reviews__content">
<div class="reviews__text">“Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Donec sed odio dui. Aenean eu leo quam...”</div>
<div class="reviews__author">Susan Sims, Interaction Designer at XYZ</div>
</div>
</div>
</div>
</div>
</div> <!--container -->
</div><!--reviews -->
<!--JavaScript!-->
<script src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>
<script src="app.js"> </script>
</body>
</html> |
|
| JavaScript | 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
| $(function(){
/* Fixed Heade*/
let header = $("#header");
let intro = $("#intro");
let introH;
let scrollPos = $(window).scrollTop();
let nav = $("#nav");
let navToggle = $("#navToggle");
$(window).on("scroll load resize", function() {
introH = intro.innerHeight();
scrollPos = $(this).scrollTop();
if( scrollPos > introH ){
header.addClass("fixed");
} else {
header.removeClass("fixed");
}
});
/* Smooth scroll*/
$("[data-scroll]").on("click", function(event) {
event.preventDefault();
let elementId = $(this).data('scroll');
let elementOffset = $(elementId).offset().top;
nav.removeClass("show");
$("html, body").animate({
scrollTop:elementOffset - 70
}, 700);
});
/* Nav Toggle*/
navToggle.on("click", function(event){
event.preventDefault();
nav. toggleClass("show");
});
/*Reviews */
let slider = $("#reviewsslider");
slider.slick({
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
fade: true,
arrows: false,
dots: true
});
}); |
|
| CSS | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
| body {
margin: 0;
font-family: 'Raleway', sans-serif;
font-size: 14px;
color: #6c7279;
background-color: #fff;
-webkit-font- smoothinng:antialiased;
}
*,
*:before,
*:after {
box-sizing: border-box;
}
h1,h2,h3,h4,h5,h6 {
margin: 0;
}
p {
margin: 0 0 10px;
}
/*CONTAINER
=============*/
.container {
width: 100%;
max-width:inherit;
margin: 0 auto;
padding: 0 10px;
}
/*HEADER
=============*/
.header{
width: 100%;
height: 100px;
position: absolute;
top:0;
left: 0;
z-index: 1000;
}
.header.fixed {
height: auto;
position: fixed;
background-color: #31344e;
}
.header.fixed .header__iner{
padding-bottom: 15px;
padding-top: 15px;
border-bottom: 0;
}
.header__iner{
display: flex;
justify-content: space-between;
padding: 35px 0;
align-items: center;
border-bottom: 1px solid#515369;
}
/*nav
=============*/
.nav {
display: flex;
font-size: 13px;
font-weight: 700;
text-transform: uppercase;
}
.nav__link {
margin-left: 50px;
color: #fff;
text-decoration: none;
opacity: 0.75;
transition: opacity 0.1s linear;
}
.nav__link:first-child{
margin-left: 0px;
}
.nav__link:hover{
text-decoration: underline;
opacity: 1;
}
/*INTRO
=============*/
.intro{
display: flex;
flex-direction: column;
justify-content: center;
height: 750px;
padding-top: 100px;
background: #31344e
url(img/Intro-bg.jpg)
no-repeat;
background-size: cover;
}
.intro__iner{
width: 100%;
max-width: 970px;
margin: 0 auto;
text-align: center;
}
.intro__title{
margin: 0 0 30px;
font-family: 'Open Sans',
sans-serif;
font-size: 65px;
line-height: 1.1;
color: #fff;
font-weight: 700;
text-transform: uppercase;
text-align: center;
}
.intro__subtitle{
font-style:22px;
color:#fff;
line-height: 1.5;
font-weight: 400;
margin-bottom: 60px;
}
/*Button
=============*/
.btn{
display:inline-block;
vertical-align: top;
padding: 14px 40px;
border-radius: 3px;
font-family: 'Raleway', sans-serif;
border:0;
cursor: pointer;
font-size: 13px;
color:#fff;
font-weight: 600;
text-transform: uppercase;
transition: background .1s linear;
text-align: center;
}
.btn__red{
background-color: #e84545;
text-decoration: none;
}
.btn__red:hover{
background-color: #db2222;
}
.btn__long{
min-width: 280px;
}
/*Feature
=============*/
.feature{
display: flex;
flex-wrap: wrap;
margin: 100px 0;
}
.feature__item{
width: 33.33333%;
padding: 0 40px;
margin: 25px 0;
text-align: center;
}
.feature__icon{
margin-bottom: 20px;
}
.feature__title{
margin-bottom: 20px;
font-size: 14px;
color: #2d3033;
font-weight: 700;
text-transform: uppercase;
}
.feature__text{
font-size:14px;
line-height: 1.5;
color: #6c7279;
}
/*Work
============*/
.work{
display: flex;
flex-wrap: wrap;
}
.work__item{
width: 25%;
height: 350px;
border-bottom: 1px solid #fff;
border-right: 1px solid #fff;
position: relative;
overflow: hidden;
}
.work__item:hover .work__content{
opacity: 1;
}
.work__photo{
min-width: 100%;
position: absolute;
top:50%;
left: 50%;
z-index: 1;
transform: translate3d(-50%, -50%, 0);
}
.work__content{
display: flex;
flex-direction: column;
justify-content: center;
width: 100%;
height: 100%;
background-color: rgba(232,69,69,.9);
opacity:0;
text-align: center;
position: absolute;
top: 0;
left: 0;
z-index: 2;
transition: opacity .2s linear;
}
.work__title{
margin-bottom: 5px;
font-size: 14px;
font-weight: 700;
color:#fff;
text-transform: uppercase;
}
.work__text{
font-size: 14px;
color:#fff;
}
/*Team
============*/
.team{
margin: 100px 0 70px;
}
.team__inet{
display: flex;
flex-wrap: wrap;
margin: 0 -15px;
}
.team__item{
width: 25%;
padding: 0 15px;
margin-bottom: 30px;
}
.team__photo{
display: block;
max-width: 100%;
height: auto;
margin-bottom: 20px;
}
.team__name{
margin-bottom: 8px;
font-size: 22px;
color:#000;
}
.team__prof{
margin-bottom: 15px;
font-size: 13px;
color:#e84545;
text-transform: uppercase;
}
.team-text{
margin-bottom: 20px;
font-size: 14px;
line-height: 1.5;
color:#6c7279;
}
/*Social
============*/
.social{
display: flex;
}
.social__footer{
justify-content: center;
}
.social__item{
margin-right: 4px;
display: flex;
justify-content: center;
align-items: center;
width: 40px;
height: 40px;
border: 1px solid #e8ecee;
}
.social__footer .social__item{
background: none;
border-width: 2px;
border-color: #fff;
border-radius: 2px;
}
.social__footer
.social__item:hover{
background-color: #fff;
}
/*Reviews*
==============*/
.reviews{
overflow: hidden;
background-color: #53354a;
}
.reviews__item{
display: flex;
flex-wrap: wrap;
}
.reviews__photo{
width: 50%;
height: 500px;
position: relative;
}
.reviews__img{
position: absolute;
top:50%;
right: 0;
z-index: 1;
transform: translateY(-50%);
}
.reviews__content{
display: flex;
flex-direction: column;
justify-content: center;
width: 50%;
padding-left:80px;
}
.reviews__text{
margin-bottom: 20px;
font-family: 'Cardo', sans-serif;
font-style: italic;
font-size: 36px;
line-height: 1.2;
color: #fff;
}
.reviews__author{
font-size:13px;
font-weight: bold;
text-transform: uppercase;
color: #fff;
}
.slick-dots{
display: flex;
justify-content: center;
margin: 0;
padding: 0 0 10px;
list-style: none;
width: 50%;
width: 50%;
position: absolute;
bottom: 0;
right: 0;
z-index: 2;
}
.slick-dots li{
margin: 0 5px;
}
.slick-dots button{
width: 15%;
height: 15%;
background: #fff;
border-radius: 50%;
padding: 0;
border: 0;
opacity: .05;
cursor: pointer;
font-size: 0;
color: transparent;
}
.slick-dots button:focus{
outline: 0;
}
.slick-dots .slick-active button{
opacity: 1;
} |
|
0
|