This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zalo-slider-functions.js
78 lines (71 loc) · 1.82 KB
/
zalo-slider-functions.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
jQuery(function( $ ){
var currentslicksliderindex = 0;
var newslicksliderindex;
$('.slickslider').slick({
infinite: true,
dots: true,
adaptiveHeight: false,
variableWidth: false,
speed: 500,
centerMode: true,
centerPadding: '100px',
slidesToShow: 1,
arrows: true,
cssEase: 'ease',
swipe: true,
draggable: true,
touchMove: true,
onAfterChange: function(slide, index){
newslicksliderindex = $(slide.$slides.get(index)).attr('index');
},
responsive: [
{
breakpoint: 1023,
settings: {
centerPadding: '80px',
}
},
{
breakpoint: 782,
settings: {
centerPadding: '60px',
}
},
{
breakpoint: 480,
settings: {
centerPadding: '40px',
}
}
]
});
slickdots = function() {
$sliderimageheight = 0;
$slidernavheight = 0;
$slickdots = 0;
$sliderimageheight = $(".slick-active .slider-image .wp-post-image").outerHeight();
$slidernavheight = $(".slick-prev").outerHeight();
$slidernavtop = Math.floor(parseInt( ($sliderimageheight) / 2) - ($slidernavheight / 2) );
$slickdots = Math.floor(parseInt( ( $sliderimageheight + 10 ) ));
$('.slick-prev').css('top', $slidernavtop);
$('.slick-next').css('top', $slidernavtop);
$('.slick-dots').css('top', $slickdots)
};
$(document).ready(function() {
$( ".slider-image" ).on( "lazyload.bj", "img", function() {
$('.slick-active .slider-image').imagesLoaded( slickdots );
});
});
$(window).bind('resize', function(e)
{
window.resizeEvt;
$(window).resize(function()
{
clearTimeout(window.resizeEvt);
window.resizeEvt = setTimeout(function()
{
slickdots();
}, 250);
});
});
});