-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain-product--default.liquid
101 lines (99 loc) · 3.61 KB
/
main-product--default.liquid
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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/[email protected]/slick/slick.css"/>
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/[email protected]/slick/slick.min.js"></script>
<script type="text/javascript">
$('.product__media').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
asNavFor: '.product__thumbnails__slider',
fade: true,
adaptiveHeight: true,
prevArrow: '<button type="button" class="carousel-navigation carousel-navigation__previous-button slick-prev" aria-hidden="true"><span class="icon "><svg width="100%" viewBox="0 0 24 24" style="opacity: 1; transform: translate(0px, 0px);"><path d="M12 0 9.87 2.11l8.35 8.36H0v3h18.22l-8.35 8.36L12 23.94 24 12z" fill="currentColor" focusable="false"></path></svg></span></button>',
nextArrow: '<button type="button" class="carousel-navigation carousel-navigation__next-button slick-next" aria-hidden="true"><span class="icon "><svg width="100%" viewBox="0 0 24 24"><path d="M12 0 9.87 2.11l8.35 8.36H0v3h18.22l-8.35 8.36L12 23.94 24 12z" fill="currentColor" focusable="false"></path></svg></span></button>',
});
$('.product__thumbnails__slider').slick({
slidesToShow: 4,
slidesToScroll: 4,
asNavFor: '.product__media',
arrows: false,
dots: false,
centerMode: false,
focusOnSelect: true,
focusOnChange: false,
infinite: true,
adaptiveHeight: false,
});
$('.product__color-swatches').on('click', function(){
var activeContainer = document.querySelectorAll('.product__color-swatches .selected');
$('.variant_name').text($(activeContainer).attr("data-label"));
});
$('.product__color-swatches').on('click', function(){
var slideno = $(".product__media-item:not(.hidden)").data('slick-index')
$('.product__media').slick('slickGoTo', slideno);
});
$(function() {
var activeContainer = document.querySelectorAll('.product__color-swatches .selected');
$('.variant_name').text($(activeContainer).attr("data-label"));
var slideno = $(".product__media-item:not(.hidden)").data('slick-index')
$('.product__media').slick('slickGoTo', slideno);
});
$('.product__color-swatches').on('click', function(){
var activeContainer = document.querySelectorAll('.product__color-swatches .selected');
$('.variant_name').text($(activeContainer).attr("data-label"));
});
</script>
<style>
.product__thumbnails-wrapper {
margin-top: 15px;
}
.product__thumbnails__slider {
max-width: 100%;
margin: 0 auto;
}
.product__thumbnails__slider .slick-track {
display: flex !important;
height: inherit !important;
max-height: 225px;
}
.product__thumbnails__slider .slick-slide,
.product-thumbnails__item-link .image__img
{
height: inherit !important;
}
.product__thumbnails__slider .slick-list {
margin: 0 -17px !important;
}
.product__thumbnails__slider .slick-slide > button {
padding: 0 17px !important;
}
.product-thumbnails__item-image {
margin: 0 5px;
}
.product-thumbnails__item-link.active .image__img {
box-shadow: none !important;
}
.product-thumbnails__item-link.slick-current.slick-active .image__img {
border: 3px solid var(--color-background-button);
}
.product__media .slick-arrow{
position: absolute;
top: 50%;
margin-top: -15px;
z-index: 1;
}
.product__media .slick-prev{
left: -10px;
}
.product__media .slick-next{
right: -10px;
}
.product__media:hover .carousel-navigation {
opacity: 1;
}
@media (max-width: 42em) {
.product__thumbnails__slider {
display: none;
}
}
</style>