zz-shopify-components 0.0.27 → 0.0.28-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -21
- package/README.md +70 -56
- package/assets/ScrollTrigger.min.js +11 -11
- package/assets/gsap.min.js +11 -11
- package/assets/jquery.js +2 -2
- package/assets/lazy-video.js +2 -2
- package/assets/lazyload.min.js +1 -1
- package/assets/lozad.js +10 -10
- package/assets/site-jump.js +52 -52
- package/assets/site-jumpV2.js +35 -35
- package/assets/swiper-bundle.min.css +12 -12
- package/assets/swiper-bundle.min.js +13 -13
- package/assets/swiper.css +330 -330
- package/assets/zz-components.css +322 -322
- package/assets/zz-components.js +166 -166
- package/assets/zz-fade-in-content.js +169 -169
- package/assets/zz-http-request.js +73 -73
- package/assets/zz-world-video-comments-dialog.js +240 -240
- package/assets/zz-world-video-dialog.js +190 -190
- package/assets/zz-world-video-list.js +317 -317
- package/assets/zz-world-video.js +270 -270
- package/blocks/zz-accessories-item.liquid +188 -188
- package/blocks/zz-accessories-swiper.liquid +223 -223
- package/blocks/zz-button.liquid +216 -216
- package/blocks/zz-content-description-html.liquid +201 -201
- package/blocks/zz-content-description.liquid +209 -209
- package/blocks/zz-flex-layout-bg-block.liquid +524 -524
- package/blocks/zz-flex-layout-block.liquid +549 -549
- package/blocks/zz-flex-layout-widget.liquid +321 -321
- package/blocks/zz-full-screen-swiper.liquid +443 -443
- package/blocks/zz-icon.liquid +46 -46
- package/blocks/zz-mail.liquid +135 -135
- package/blocks/zz-mb-swiper-pc-flex.liquid +273 -273
- package/blocks/zz-price-tag-mini.liquid +106 -106
- package/blocks/zz-price-tag.liquid +41 -41
- package/blocks/zz-ratio-image.liquid +181 -181
- package/blocks/zz-ratio-video.liquid +115 -115
- package/blocks/zz-responsive-width-image.liquid +222 -222
- package/blocks/zz-responsive-width-video.liquid +166 -166
- package/blocks/zz-scroll-animate-bg-text.liquid +268 -268
- package/blocks/zz-scroll-cover.liquid +67 -67
- package/blocks/zz-tag.liquid +50 -50
- package/blocks/zz-text.liquid +227 -227
- package/blocks/zz-title.liquid +287 -287
- package/blocks/zz-video-button.liquid +84 -84
- package/blocks/zz-video-img-item.liquid +203 -203
- package/blocks/zz-video-img-list.liquid +166 -166
- package/blocks/zz-video-swiper-perview-item.liquid +221 -221
- package/blocks/zz-video-swiper-perview.liquid +585 -585
- package/blocks/zz-world-video.liquid +639 -639
- package/component.config.json +7 -7
- package/package.json +1 -1
- package/scripts/postinstall-v1.js +39 -39
- package/scripts/postinstall-v2.js +47 -47
- package/scripts/postinstall-v3.js +51 -51
- package/scripts/publish-npm.js +43 -43
- package/sections/zz-flex-layout-section.liquid +269 -269
- package/sections/zz-navigation-tab-v3.liquid +409 -409
- package/sections/zz-navigation-tab.liquid +411 -411
- package/sections/zz-shopping-card-list.liquid +399 -399
- package/sections/zz-video-collapse-swiper.liquid +522 -522
- package/sections/zz-video-tab-swiper.liquid +748 -748
- package/snippets/zz-button.liquid +70 -70
- package/snippets/zz-content-h3.liquid +15 -15
- package/snippets/zz-content-text.liquid +56 -56
- package/snippets/zz-h2.liquid +31 -31
- package/snippets/zz-h3.liquid +31 -31
- package/snippets/zz-h4.liquid +30 -30
- package/snippets/zz-h5.liquid +39 -39
- package/snippets/zz-h6.liquid +39 -39
- package/snippets/zz-icon-next.liquid +17 -17
- package/snippets/zz-icon-prev.liquid +17 -17
- package/snippets/zz-icon.liquid +74 -74
- package/snippets/zz-img-md.liquid +44 -44
- package/snippets/zz-img.liquid +44 -44
- package/snippets/zz-prev-next-blur-icon.liquid +36 -36
- package/snippets/zz-prev-next-btn.liquid +62 -62
- package/snippets/zz-price-tag.liquid +22 -22
- package/snippets/zz-spoke.liquid +142 -142
- package/snippets/zz-tag.liquid +22 -22
- package/snippets/zz-video-button.liquid +54 -54
- package/snippets/zz-video-md.liquid +117 -117
- package/snippets/zz-video.liquid +117 -117
|
@@ -1,223 +1,223 @@
|
|
|
1
|
-
{% assign block_size = block.blocks.size %}
|
|
2
|
-
{% assign bullets_width_half = block_size
|
|
3
|
-
| minus: 1
|
|
4
|
-
| times: 14
|
|
5
|
-
| plus: 6
|
|
6
|
-
| divided_by: 2.0
|
|
7
|
-
| ceil
|
|
8
|
-
%}
|
|
9
|
-
{% assign btn_offset = bullets_width_half | plus: 14 | plus: 36 %}
|
|
10
|
-
|
|
11
|
-
{% assign btn_offset_pc = bullets_width_half | plus: 18 | plus: 48 %}
|
|
12
|
-
|
|
13
|
-
<style>
|
|
14
|
-
#shopify-block-{{ block.id }} {
|
|
15
|
-
width: 100%;
|
|
16
|
-
}
|
|
17
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper {
|
|
18
|
-
padding-top: 32px;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: fit-content;
|
|
21
|
-
background: {{ block.settings.bg_color }};
|
|
22
|
-
letter-spacing: 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-slide {
|
|
26
|
-
width: 320px;
|
|
27
|
-
height: fit-content;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
#shopify-block-{{ block.id }} .swiper-button-next,
|
|
31
|
-
#shopify-block-{{ block.id }} .swiper-button-prev {
|
|
32
|
-
z-index: 99;
|
|
33
|
-
top: unset;
|
|
34
|
-
bottom: 0;
|
|
35
|
-
width: 48px;
|
|
36
|
-
height: 48px;
|
|
37
|
-
}
|
|
38
|
-
#shopify-block-{{ block.id }} .swiper-button-prev {
|
|
39
|
-
left: 50%;
|
|
40
|
-
transform: translate(-{{ btn_offset_pc }}px, 0px);
|
|
41
|
-
}
|
|
42
|
-
#shopify-block-{{ block.id }} .swiper-button-next {
|
|
43
|
-
right: 50%;
|
|
44
|
-
transform: translate({{ btn_offset_pc }}px, 0px);
|
|
45
|
-
}
|
|
46
|
-
#shopify-block-{{ block.id }} .swiper-button-next:after,
|
|
47
|
-
#shopify-block-{{ block.id }} .swiper-button-prev:after {
|
|
48
|
-
display: none;
|
|
49
|
-
}
|
|
50
|
-
#shopify-block-{{ block.id }} .swiper-button-next.swiper-button-disabled, #shopify-block-{{ block.id }} .swiper-button-prev.swiper-button-disabled {
|
|
51
|
-
opacity: 0.5;
|
|
52
|
-
}
|
|
53
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets {
|
|
54
|
-
bottom: 11px;
|
|
55
|
-
}
|
|
56
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
|
|
57
|
-
margin: 0 6px;
|
|
58
|
-
width: 6px;
|
|
59
|
-
height: 6px;
|
|
60
|
-
background-color: {{ block.settings.pagination_color }};
|
|
61
|
-
opacity: 0.5;
|
|
62
|
-
}
|
|
63
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active {
|
|
64
|
-
opacity: 1;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@media screen and (min-width: 1024px) {
|
|
68
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper {
|
|
69
|
-
padding-top: 64px;
|
|
70
|
-
padding-bottom: 108px;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@media screen and (max-width: 1023px) {
|
|
75
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper {
|
|
76
|
-
padding: 0px 20px 60px 20px;
|
|
77
|
-
box-sizing: border-box;
|
|
78
|
-
}
|
|
79
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-slide {
|
|
80
|
-
width: 100%;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
#shopify-block-{{ block.id }} .swiper-button-next,
|
|
84
|
-
#shopify-block-{{ block.id }} .swiper-button-prev {
|
|
85
|
-
width: 36px;
|
|
86
|
-
height: 36px;
|
|
87
|
-
}
|
|
88
|
-
#shopify-block-{{ block.id }} .swiper-button-prev {
|
|
89
|
-
left: 50%;
|
|
90
|
-
transform: translate(-{{ btn_offset }}px, 0px);
|
|
91
|
-
}
|
|
92
|
-
#shopify-block-{{ block.id }} .swiper-button-next {
|
|
93
|
-
right: 50%;
|
|
94
|
-
transform: translate({{ btn_offset }}px, 0px);
|
|
95
|
-
}
|
|
96
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets {
|
|
97
|
-
bottom: 9px;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
|
|
101
|
-
margin: 0 4px;
|
|
102
|
-
width: 6px;
|
|
103
|
-
height: 6px;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
</style>
|
|
107
|
-
|
|
108
|
-
<div
|
|
109
|
-
class='swiper zz-accessories-swiper'
|
|
110
|
-
data-id='{{ block.id }}'
|
|
111
|
-
>
|
|
112
|
-
<div class='swiper-wrapper'>
|
|
113
|
-
{% content_for 'blocks' %}
|
|
114
|
-
</div>
|
|
115
|
-
<!-- If we need navigation buttons -->
|
|
116
|
-
<div class='swiper-button-prev {% if block_size <= 1 %} tw-hidden {% endif %}'>
|
|
117
|
-
{% if block.settings.prev_icon != blank %}
|
|
118
|
-
{{
|
|
119
|
-
block.settings.prev_icon
|
|
120
|
-
| image_url: width: 48
|
|
121
|
-
| image_tag: alt: 'prev', class: 'tw-w-full tw-h-full tw-object-contain'
|
|
122
|
-
}}
|
|
123
|
-
{% else %}
|
|
124
|
-
{% render 'zz-icon-prev' %}
|
|
125
|
-
{% endif %}
|
|
126
|
-
</div>
|
|
127
|
-
<div class='swiper-button-next {% if block_size <= 1 %} tw-hidden {% endif %}'>
|
|
128
|
-
{% if block.settings.next_icon != blank %}
|
|
129
|
-
{{
|
|
130
|
-
block.settings.next_icon
|
|
131
|
-
| image_url: width: 48
|
|
132
|
-
| image_tag: alt: 'prev', class: 'tw-w-full tw-h-full tw-object-contain'
|
|
133
|
-
}}
|
|
134
|
-
{% else %}
|
|
135
|
-
{% render 'zz-icon-next' %}
|
|
136
|
-
{% endif %}
|
|
137
|
-
</div>
|
|
138
|
-
|
|
139
|
-
<!-- Pagination indicator -->
|
|
140
|
-
<div class='swiper-pagination'></div>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<script>
|
|
144
|
-
const blockId = '{{ block.id }}';
|
|
145
|
-
document.addEventListener('DOMContentLoaded', function () {
|
|
146
|
-
// 轮播图每个 wrapper 之间的间距
|
|
147
|
-
let isDesktop = window.innerWidth > 1023;
|
|
148
|
-
|
|
149
|
-
// 获取 class zz-accessories-swiper 的元素 且data-id 为 block.id 的元素
|
|
150
|
-
const zzAccessoriesSwiper = document.querySelector(
|
|
151
|
-
`.zz-accessories-swiper[data-id='${blockId}']`
|
|
152
|
-
);
|
|
153
|
-
const swiperWrapper = zzAccessoriesSwiper.querySelector('.swiper-wrapper');
|
|
154
|
-
// 获取当前 swiper-wrapper 下面 所有 第一层 div
|
|
155
|
-
const swiperSlides = swiperWrapper.querySelectorAll(':scope > div');
|
|
156
|
-
// 给每个 swiper-slide 添加 class swiper-slide
|
|
157
|
-
swiperSlides.forEach((slide) => {
|
|
158
|
-
slide.classList.add('swiper-slide');
|
|
159
|
-
});
|
|
160
|
-
setTimeout(() => {
|
|
161
|
-
const bannerAccessoriesSwiper = new Swiper('.zz-accessories-swiper', {
|
|
162
|
-
initialSlide: isDesktop ? 1 : 0,
|
|
163
|
-
slidesPerView: 'auto',
|
|
164
|
-
centeredSlides: true,
|
|
165
|
-
spaceBetween: isDesktop ? 24 : 8,
|
|
166
|
-
navigation: {
|
|
167
|
-
nextEl: '.swiper-button-next',
|
|
168
|
-
prevEl: '.swiper-button-prev',
|
|
169
|
-
},
|
|
170
|
-
pagination: {
|
|
171
|
-
el: '.swiper-pagination',
|
|
172
|
-
clickable: true,
|
|
173
|
-
},
|
|
174
|
-
effect: 'slide',
|
|
175
|
-
});
|
|
176
|
-
}, 200);
|
|
177
|
-
});
|
|
178
|
-
</script>
|
|
179
|
-
|
|
180
|
-
{% schema %}
|
|
181
|
-
{
|
|
182
|
-
"name": "Accessories Swiper Block",
|
|
183
|
-
"settings": [
|
|
184
|
-
{
|
|
185
|
-
"type": "color",
|
|
186
|
-
"id": "bg_color",
|
|
187
|
-
"default": "#FFFFFF",
|
|
188
|
-
"label": "背景色"
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
{
|
|
192
|
-
"type": "color",
|
|
193
|
-
"id": "pagination_color",
|
|
194
|
-
"default": "#000000",
|
|
195
|
-
"label": "轮播导航圆圈颜色"
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
{
|
|
199
|
-
"type": "image_picker",
|
|
200
|
-
"id": "prev_icon",
|
|
201
|
-
"label": "轮播上一张图标"
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"type": "image_picker",
|
|
205
|
-
"id": "next_icon",
|
|
206
|
-
"label": "轮播下一张图标"
|
|
207
|
-
}
|
|
208
|
-
],
|
|
209
|
-
"blocks": [
|
|
210
|
-
{
|
|
211
|
-
"type": "zz-accessories-item"
|
|
212
|
-
}
|
|
213
|
-
],
|
|
214
|
-
"presets": [
|
|
215
|
-
{
|
|
216
|
-
"name": "Accessories Swiper Block"
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
"name": "配件轮播"
|
|
220
|
-
}
|
|
221
|
-
]
|
|
222
|
-
}
|
|
223
|
-
{% endschema %}
|
|
1
|
+
{% assign block_size = block.blocks.size %}
|
|
2
|
+
{% assign bullets_width_half = block_size
|
|
3
|
+
| minus: 1
|
|
4
|
+
| times: 14
|
|
5
|
+
| plus: 6
|
|
6
|
+
| divided_by: 2.0
|
|
7
|
+
| ceil
|
|
8
|
+
%}
|
|
9
|
+
{% assign btn_offset = bullets_width_half | plus: 14 | plus: 36 %}
|
|
10
|
+
|
|
11
|
+
{% assign btn_offset_pc = bullets_width_half | plus: 18 | plus: 48 %}
|
|
12
|
+
|
|
13
|
+
<style>
|
|
14
|
+
#shopify-block-{{ block.id }} {
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper {
|
|
18
|
+
padding-top: 32px;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: fit-content;
|
|
21
|
+
background: {{ block.settings.bg_color }};
|
|
22
|
+
letter-spacing: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-slide {
|
|
26
|
+
width: 320px;
|
|
27
|
+
height: fit-content;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#shopify-block-{{ block.id }} .swiper-button-next,
|
|
31
|
+
#shopify-block-{{ block.id }} .swiper-button-prev {
|
|
32
|
+
z-index: 99;
|
|
33
|
+
top: unset;
|
|
34
|
+
bottom: 0;
|
|
35
|
+
width: 48px;
|
|
36
|
+
height: 48px;
|
|
37
|
+
}
|
|
38
|
+
#shopify-block-{{ block.id }} .swiper-button-prev {
|
|
39
|
+
left: 50%;
|
|
40
|
+
transform: translate(-{{ btn_offset_pc }}px, 0px);
|
|
41
|
+
}
|
|
42
|
+
#shopify-block-{{ block.id }} .swiper-button-next {
|
|
43
|
+
right: 50%;
|
|
44
|
+
transform: translate({{ btn_offset_pc }}px, 0px);
|
|
45
|
+
}
|
|
46
|
+
#shopify-block-{{ block.id }} .swiper-button-next:after,
|
|
47
|
+
#shopify-block-{{ block.id }} .swiper-button-prev:after {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
#shopify-block-{{ block.id }} .swiper-button-next.swiper-button-disabled, #shopify-block-{{ block.id }} .swiper-button-prev.swiper-button-disabled {
|
|
51
|
+
opacity: 0.5;
|
|
52
|
+
}
|
|
53
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets {
|
|
54
|
+
bottom: 11px;
|
|
55
|
+
}
|
|
56
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
|
|
57
|
+
margin: 0 6px;
|
|
58
|
+
width: 6px;
|
|
59
|
+
height: 6px;
|
|
60
|
+
background-color: {{ block.settings.pagination_color }};
|
|
61
|
+
opacity: 0.5;
|
|
62
|
+
}
|
|
63
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media screen and (min-width: 1024px) {
|
|
68
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper {
|
|
69
|
+
padding-top: 64px;
|
|
70
|
+
padding-bottom: 108px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media screen and (max-width: 1023px) {
|
|
75
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper {
|
|
76
|
+
padding: 0px 20px 60px 20px;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
}
|
|
79
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-slide {
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
#shopify-block-{{ block.id }} .swiper-button-next,
|
|
84
|
+
#shopify-block-{{ block.id }} .swiper-button-prev {
|
|
85
|
+
width: 36px;
|
|
86
|
+
height: 36px;
|
|
87
|
+
}
|
|
88
|
+
#shopify-block-{{ block.id }} .swiper-button-prev {
|
|
89
|
+
left: 50%;
|
|
90
|
+
transform: translate(-{{ btn_offset }}px, 0px);
|
|
91
|
+
}
|
|
92
|
+
#shopify-block-{{ block.id }} .swiper-button-next {
|
|
93
|
+
right: 50%;
|
|
94
|
+
transform: translate({{ btn_offset }}px, 0px);
|
|
95
|
+
}
|
|
96
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets {
|
|
97
|
+
bottom: 9px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
|
|
101
|
+
margin: 0 4px;
|
|
102
|
+
width: 6px;
|
|
103
|
+
height: 6px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
107
|
+
|
|
108
|
+
<div
|
|
109
|
+
class='swiper zz-accessories-swiper'
|
|
110
|
+
data-id='{{ block.id }}'
|
|
111
|
+
>
|
|
112
|
+
<div class='swiper-wrapper'>
|
|
113
|
+
{% content_for 'blocks' %}
|
|
114
|
+
</div>
|
|
115
|
+
<!-- If we need navigation buttons -->
|
|
116
|
+
<div class='swiper-button-prev {% if block_size <= 1 %} tw-hidden {% endif %}'>
|
|
117
|
+
{% if block.settings.prev_icon != blank %}
|
|
118
|
+
{{
|
|
119
|
+
block.settings.prev_icon
|
|
120
|
+
| image_url: width: 48
|
|
121
|
+
| image_tag: alt: 'prev', class: 'tw-w-full tw-h-full tw-object-contain'
|
|
122
|
+
}}
|
|
123
|
+
{% else %}
|
|
124
|
+
{% render 'zz-icon-prev' %}
|
|
125
|
+
{% endif %}
|
|
126
|
+
</div>
|
|
127
|
+
<div class='swiper-button-next {% if block_size <= 1 %} tw-hidden {% endif %}'>
|
|
128
|
+
{% if block.settings.next_icon != blank %}
|
|
129
|
+
{{
|
|
130
|
+
block.settings.next_icon
|
|
131
|
+
| image_url: width: 48
|
|
132
|
+
| image_tag: alt: 'prev', class: 'tw-w-full tw-h-full tw-object-contain'
|
|
133
|
+
}}
|
|
134
|
+
{% else %}
|
|
135
|
+
{% render 'zz-icon-next' %}
|
|
136
|
+
{% endif %}
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<!-- Pagination indicator -->
|
|
140
|
+
<div class='swiper-pagination'></div>
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<script>
|
|
144
|
+
const blockId = '{{ block.id }}';
|
|
145
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
146
|
+
// 轮播图每个 wrapper 之间的间距
|
|
147
|
+
let isDesktop = window.innerWidth > 1023;
|
|
148
|
+
|
|
149
|
+
// 获取 class zz-accessories-swiper 的元素 且data-id 为 block.id 的元素
|
|
150
|
+
const zzAccessoriesSwiper = document.querySelector(
|
|
151
|
+
`.zz-accessories-swiper[data-id='${blockId}']`
|
|
152
|
+
);
|
|
153
|
+
const swiperWrapper = zzAccessoriesSwiper.querySelector('.swiper-wrapper');
|
|
154
|
+
// 获取当前 swiper-wrapper 下面 所有 第一层 div
|
|
155
|
+
const swiperSlides = swiperWrapper.querySelectorAll(':scope > div');
|
|
156
|
+
// 给每个 swiper-slide 添加 class swiper-slide
|
|
157
|
+
swiperSlides.forEach((slide) => {
|
|
158
|
+
slide.classList.add('swiper-slide');
|
|
159
|
+
});
|
|
160
|
+
setTimeout(() => {
|
|
161
|
+
const bannerAccessoriesSwiper = new Swiper('.zz-accessories-swiper', {
|
|
162
|
+
initialSlide: isDesktop ? 1 : 0,
|
|
163
|
+
slidesPerView: 'auto',
|
|
164
|
+
centeredSlides: true,
|
|
165
|
+
spaceBetween: isDesktop ? 24 : 8,
|
|
166
|
+
navigation: {
|
|
167
|
+
nextEl: '.swiper-button-next',
|
|
168
|
+
prevEl: '.swiper-button-prev',
|
|
169
|
+
},
|
|
170
|
+
pagination: {
|
|
171
|
+
el: '.swiper-pagination',
|
|
172
|
+
clickable: true,
|
|
173
|
+
},
|
|
174
|
+
effect: 'slide',
|
|
175
|
+
});
|
|
176
|
+
}, 200);
|
|
177
|
+
});
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
{% schema %}
|
|
181
|
+
{
|
|
182
|
+
"name": "Accessories Swiper Block",
|
|
183
|
+
"settings": [
|
|
184
|
+
{
|
|
185
|
+
"type": "color",
|
|
186
|
+
"id": "bg_color",
|
|
187
|
+
"default": "#FFFFFF",
|
|
188
|
+
"label": "背景色"
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
{
|
|
192
|
+
"type": "color",
|
|
193
|
+
"id": "pagination_color",
|
|
194
|
+
"default": "#000000",
|
|
195
|
+
"label": "轮播导航圆圈颜色"
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
{
|
|
199
|
+
"type": "image_picker",
|
|
200
|
+
"id": "prev_icon",
|
|
201
|
+
"label": "轮播上一张图标"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"type": "image_picker",
|
|
205
|
+
"id": "next_icon",
|
|
206
|
+
"label": "轮播下一张图标"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"blocks": [
|
|
210
|
+
{
|
|
211
|
+
"type": "zz-accessories-item"
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"presets": [
|
|
215
|
+
{
|
|
216
|
+
"name": "Accessories Swiper Block"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"name": "配件轮播"
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
{% endschema %}
|