zz-shopify-components 0.0.21 → 0.0.22

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +21 -21
  2. package/README.md +56 -56
  3. package/assets/ScrollTrigger.min.js +11 -11
  4. package/assets/gsap.min.js +11 -11
  5. package/assets/jquery.js +2 -2
  6. package/assets/lazy-video.js +2 -2
  7. package/assets/lazyload.min.js +1 -1
  8. package/assets/lozad.js +10 -10
  9. package/assets/site-jump.js +52 -52
  10. package/assets/site-jumpV2.js +35 -35
  11. package/assets/swiper-bundle.min.css +12 -12
  12. package/assets/swiper-bundle.min.js +13 -13
  13. package/assets/swiper.css +330 -330
  14. package/assets/zz-components.css +322 -322
  15. package/assets/zz-components.js +166 -166
  16. package/assets/zz-fade-in-content.js +169 -169
  17. package/blocks/zz-accessories-item.liquid +188 -188
  18. package/blocks/zz-accessories-swiper.liquid +223 -223
  19. package/blocks/zz-button.liquid +216 -216
  20. package/blocks/zz-content-description-html.liquid +201 -201
  21. package/blocks/zz-content-description.liquid +209 -209
  22. package/blocks/zz-flex-layout-bg-block.liquid +524 -524
  23. package/blocks/zz-flex-layout-block.liquid +548 -548
  24. package/blocks/zz-flex-layout-widget.liquid +321 -321
  25. package/blocks/zz-full-screen-swiper.liquid +447 -447
  26. package/blocks/zz-icon.liquid +46 -46
  27. package/blocks/zz-mail.liquid +135 -135
  28. package/blocks/zz-mb-swiper-pc-flex.liquid +273 -273
  29. package/blocks/zz-price-tag-mini.liquid +100 -106
  30. package/blocks/zz-price-tag.liquid +41 -41
  31. package/blocks/zz-ratio-image.liquid +181 -181
  32. package/blocks/zz-ratio-video.liquid +115 -115
  33. package/blocks/zz-responsive-width-image.liquid +222 -222
  34. package/blocks/zz-responsive-width-video.liquid +166 -166
  35. package/blocks/zz-scroll-animate-bg-text.liquid +268 -268
  36. package/blocks/zz-scroll-cover.liquid +67 -67
  37. package/blocks/zz-tag.liquid +50 -50
  38. package/blocks/zz-text.liquid +227 -227
  39. package/blocks/zz-title.liquid +287 -287
  40. package/blocks/zz-video-button.liquid +84 -84
  41. package/blocks/zz-video-swiper-perview-item.liquid +221 -221
  42. package/blocks/zz-video-swiper-perview.liquid +585 -585
  43. package/component.config.json +7 -7
  44. package/package.json +1 -1
  45. package/scripts/postinstall-v1.js +39 -39
  46. package/scripts/postinstall-v2.js +47 -47
  47. package/scripts/postinstall-v3.js +51 -51
  48. package/scripts/publish-npm.js +43 -43
  49. package/sections/zz-flex-layout-section.liquid +269 -269
  50. package/sections/zz-navigation-tab-v3.liquid +407 -407
  51. package/sections/zz-navigation-tab.liquid +411 -411
  52. package/sections/zz-shopping-card-list.liquid +399 -399
  53. package/sections/zz-video-collapse-swiper.liquid +522 -522
  54. package/sections/zz-video-tab-swiper.liquid +748 -748
  55. package/snippets/zz-button.liquid +70 -70
  56. package/snippets/zz-content-h3.liquid +15 -15
  57. package/snippets/zz-content-text.liquid +56 -56
  58. package/snippets/zz-h2.liquid +31 -31
  59. package/snippets/zz-h3.liquid +31 -31
  60. package/snippets/zz-h4.liquid +30 -30
  61. package/snippets/zz-h5.liquid +39 -39
  62. package/snippets/zz-h6.liquid +39 -39
  63. package/snippets/zz-icon-next.liquid +17 -17
  64. package/snippets/zz-icon-prev.liquid +17 -17
  65. package/snippets/zz-icon.liquid +74 -74
  66. package/snippets/zz-img.liquid +44 -44
  67. package/snippets/zz-prev-next-btn.liquid +62 -62
  68. package/snippets/zz-price-tag.liquid +22 -22
  69. package/snippets/zz-spoke.liquid +142 -142
  70. package/snippets/zz-tag.liquid +22 -22
  71. package/snippets/zz-video-button.liquid +54 -54
  72. package/snippets/zz-video-md.liquid +117 -117
  73. package/snippets/zz-video.liquid +117 -117
@@ -1,447 +1,447 @@
1
- {% assign block_size = block.blocks.size %}
2
-
3
-
4
-
5
- <style>
6
- #shopify-block-{{block.id}} {
7
- background: {{ block.settings.bg_color }};
8
- width: 100vw;
9
- height: 100vh;
10
- box-sizing: border-box;
11
- overflow: hidden;
12
- position: relative;
13
- }
14
- #shopify-block-{{block.id}} .zz-full-screen-swiper {
15
- width: 100vw;
16
- height: 100vh;
17
- box-sizing: border-box;
18
- overflow: hidden;
19
- height: fit-content;
20
- position: relative;
21
- letter-spacing: 0;
22
- }
23
-
24
-
25
- #shopify-block-{{block.id}} .swiper-button-next:after,
26
- #shopify-block-{{block.id}} .swiper-button-prev:after {
27
- display: none;
28
- }
29
- #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets {
30
- bottom: 30px;
31
- }
32
-
33
- #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
34
- margin: 0 4px;
35
- width: 24px;
36
- height: 3px;
37
- border-radius: 3px;
38
- background: {{ block.settings.pagination_color | color_modify: 'alpha', 0.3 }};
39
- opacity: 1;
40
- transition: 0.3s;
41
- }
42
- #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active {
43
- position: relative;
44
- width: 48px;
45
- }
46
- #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active .progress-line {
47
- display: block;
48
- position: absolute;
49
- left: 0;
50
- top: 0;
51
- width: 0;
52
- background-color: {{ block.settings.pagination_color }};
53
- border-radius: 3px;
54
- height: 3px;
55
- }
56
-
57
- @media screen and (max-width: 1023px) {
58
- #shopify-block-{{block.id}} .swiper-button-next,
59
- #shopify-block-{{block.id}} .swiper-button-prev {
60
- display: none;
61
- }
62
- }
63
- @media screen and (min-width: 1024px) {
64
-
65
- #shopify-block-{{block.id}} .swiper-button-next,
66
- #shopify-block-{{block.id}} .swiper-button-prev {
67
- width: 48px;
68
- height: 48px;
69
- }
70
- #shopify-block-{{block.id}} .swiper-button-prev {
71
- left: 20px;
72
- top: 50%;
73
- right: unset;
74
- transform:translateY(-50%);
75
- }
76
- #shopify-block-{{block.id}} .swiper-button-next {
77
- right: 20px;
78
- left: unset;
79
- top: 50%;
80
- transform:translateY(-50%);
81
- }
82
- #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
83
- margin: 0 8px;
84
- width: 48px;
85
- height: 4px;
86
- border-radius: 3px;
87
- }
88
- #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active {
89
- width: 120px;
90
- }
91
- #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active .progress-line {
92
- height: 4px;
93
- border-radius: 3px;
94
- }
95
- }
96
-
97
- </style>
98
-
99
-
100
-
101
- <div
102
- class='zz-full-screen-swiper zz-full-screen-swiper-{{ block.id }}'
103
- >
104
- <div class='zz-swiper-wrapper'>
105
- {% content_for 'blocks' %}
106
- </div>
107
-
108
- <!-- If we need navigation buttons -->
109
- <div class='swiper-button-prev {% if block_size <= 1 %} tw-hidden {% endif %}'>
110
-
111
- {% render 'zz-prev-next-btn', type: 'prev', color_type: block.settings.prev_next_type %}
112
- </div>
113
- <div class='swiper-button-next {% if block_size <= 1 %} tw-hidden {% endif %}'>
114
- {% render 'zz-prev-next-btn', type: 'next', color_type: block.settings.prev_next_type %}
115
- </div>
116
-
117
- <!-- Pagination indicator -->
118
- <div class='swiper-pagination'></div>
119
- </div>
120
-
121
-
122
- <script>
123
-
124
- document.addEventListener('DOMContentLoaded', function () {
125
- const block = document.getElementById(
126
- 'shopify-block-{{block.id}}'
127
- );
128
-
129
- const swiperWrapper = block.querySelector('.zz-swiper-wrapper');
130
- // 获取当前 swiper-wrapper 下面 所有 第一层 div
131
- const swiperSlides = swiperWrapper.querySelectorAll(':scope > div');
132
- // 给每个 swiper-slide 添加 class swiper-slide
133
- swiperSlides.forEach(slide => {
134
- slide.classList.add('swiper-slide');
135
- });
136
- swiperWrapper.classList.add('swiper-wrapper');
137
- let progressTimer = null;
138
- const swiperClassName = '.zz-full-screen-swiper-{{ block.id }}';
139
- const fullScreenSwiper = new Swiper(swiperClassName, {
140
- loop: true,
141
- slidesPerView: 1,
142
- centeredSlides: true,
143
- navigation: {
144
- nextEl: '.swiper-button-next',
145
- prevEl: '.swiper-button-prev',
146
- },
147
- pagination: {
148
- el: '.swiper-pagination',
149
- clickable: true,
150
- renderBullet: function (index, className) {
151
- return `
152
- <span class="${className}">
153
- <span class="progress-line"></span>
154
- </span>`;
155
- },
156
- },
157
- effect: 'slide',
158
- on: {
159
- slideChangeTransitionEnd: function () {
160
- block.querySelectorAll(".swiper-pagination-bullet").forEach((bullet) => {
161
- console.log('do reset')
162
- const progressBar = bullet.querySelector(".progress-line");
163
- progressBar.style.transition = "none";
164
- progressBar.style.width = "0";
165
- });
166
- handleVideoOnSlideChange();
167
- },
168
- slideChangeTransitionStart: function () {
169
- console.log('do slideChangeTransitionStart')
170
- if (progressTimer) {
171
- clearInterval(progressTimer);
172
- }
173
- },
174
- },
175
- });
176
- handleVideoOnSlideChange();
177
-
178
-
179
- function getVisibleDisplayMedias(container) {
180
- const videos = container.querySelectorAll('video');
181
- const video = Array.from(videos).find((video) => {
182
- const style = window.getComputedStyle(video);
183
- return style.display !== 'none';
184
- });
185
- if (video) {
186
- return {
187
- video,
188
- type: 'video'
189
- }
190
- } else {
191
- const images = container.querySelectorAll('img');
192
- const image = Array.from(images).find((image) => {
193
- const style = window.getComputedStyle(image);
194
- return style.display !== 'none';
195
- });
196
- if (image) {
197
- return {
198
- image,
199
- type: 'image'
200
- }
201
- }
202
- }
203
- return null;
204
- }
205
- const endedHandler = function() {
206
-
207
- fullScreenSwiper.slideNext();
208
- if (progressTimer) {
209
- clearInterval(progressTimer);
210
- }
211
- this.removeEventListener('ended', endedHandler);
212
- };
213
-
214
- function updataMediaProgress(type, videoDom) {
215
- console.log('do updataMediaProgress')
216
- const activeBullet = block.querySelector(".swiper-pagination-bullet-active");
217
- const progressBar = activeBullet.querySelector(".progress-line");
218
- if (progressBar) {
219
- if (type === 'video') {
220
- if (progressTimer) {
221
- clearInterval(progressTimer);
222
- }
223
- // 添加新的事件监听器
224
- progressTimer = setInterval(() => {
225
- const progress = videoDom.currentTime / videoDom.duration;
226
- progressBar.style.transition = "0.2s";
227
- progressBar.style.width = `${progress * 100}%`;
228
- }, 100);
229
- videoDom.addEventListener('ended', endedHandler);
230
- } else if (type === 'image') {
231
- console.log('do animate')
232
- progressBar.style.transition = "15s";
233
- progressBar.style.width = "100%";
234
- setTimeout(() => {
235
- fullScreenSwiper.slideNext();
236
- }, 15000);
237
- }
238
- }
239
- }
240
-
241
- function handleVideoOnSlideChange() {
242
-
243
- const activeSlide = block.querySelector('.swiper-slide-active');
244
- const media = getVisibleDisplayMedias(activeSlide);
245
- const activeBullet = block.querySelector(".swiper-pagination-bullet-active");
246
- const progressBar = activeBullet.querySelector(".progress-line");
247
- if (progressBar) {
248
- console.log('do reset 1')
249
- progressBar.style.transition = "none";
250
- progressBar.style.width = "0";
251
- }
252
- if (media.type === 'video') {
253
- media.video.currentTime = 0;
254
- updataMediaProgress('video', media.video);
255
- } else if (media.type === 'image') {
256
- // 处理图片的情况
257
- updataMediaProgress('image', media.image);
258
- }
259
- }
260
- });
261
- </script>
262
-
263
- {% schema %}
264
- {
265
- "name": "Full Screen Swiper",
266
- "class": "zz-full-screen-swiper-block",
267
- "settings": [
268
- {
269
- "type": "color",
270
- "id": "bg_color",
271
- "default": "#ffffff",
272
- "label": "背景色"
273
- },
274
-
275
- {
276
- "type": "color",
277
- "id": "pagination_color",
278
- "default": "#ffffff",
279
- "label": "轮播导航圆圈颜色"
280
- },
281
- {
282
- "type": "select",
283
- "id": "prev_next_type",
284
- "label": "prev next 颜色",
285
- "options": [
286
- { "value": "dark", "label": "黑色" },
287
- { "value": "light", "label": "白色" },
288
- ],
289
- "default": "dark"
290
- },
291
- ],
292
- "blocks": [
293
- {
294
- "type": "zz-flex-layout-bg-block",
295
- }
296
- ],
297
- "presets": [
298
- {
299
- "name": "Full Screen Swiper",
300
- },
301
- {
302
- "name": "全屏轮播组件",
303
- "settings": {
304
- "bg_color": "#ffffff",
305
- "pagination_color": "#ffffff",
306
- "prev_next_type": "dark"
307
- },
308
- "blocks": [
309
- {
310
- "type": "zz-flex-layout-bg-block",
311
- "settings": {
312
- "background_color": "rgba(0,0,0,0)",
313
- "bg_type": "image",
314
- "full_screen_bg": true,
315
- "pc_background_image": "shopify://shop_images/preset_pc_full_bg_pic.png",
316
- "mobile_background_image": "shopify://shop_images/preset_mobile_full_bg_pic.png",
317
- "pc_background_video_url": "",
318
- "video_loop": false,
319
- "pc_direction": "column",
320
- "pc_gap": 40,
321
- "pc_justify": "center",
322
- "pc_align": "flex-start",
323
- "pc_padding_top": 0,
324
- "pc_padding_bottom": 0,
325
- "pc_full_width": false,
326
- "pc_xl_width": 1200,
327
- "pc_lg_width": 90,
328
- "mobile_direction": "column",
329
- "mobile_gap": 20,
330
- "mobile_justify": "flex-end",
331
- "mobile_align": "center",
332
- "mobile_padding_bottom": 100,
333
- },
334
- "blocks": [
335
- {
336
- "type": "zz-responsive-width-image",
337
- "settings": {
338
- "desktop_image": "shopify://shop_images/1_521b8e7f-8da9-4df0-9ee1-10a25ee62323.png",
339
- "desktop_width_xl": 322,
340
- "desktop_width_lg": 322,
341
- "desktop_border_radius": 0,
342
- "mobile_image": "shopify://shop_images/12_5bbff2ea-19fe-46e1-944b-f78a79ae2d4a.png",
343
- "mb_width_type": "mb_use_padding",
344
- "mobile_padding_x": 60,
345
- "mobile_width": 60,
346
- "mb_width_px": 100,
347
- "mobile_border_radius": 0,
348
- "alt": "image loading",
349
- },
350
- },
351
- {
352
- "type": "zz-title",
353
- "settings": {
354
- "pc_title": "<p>OFFICIAL FLYING CAMERA OF<br/>USA CYCLING TEAM</p>",
355
- "mb_title": "<p>OFFICIAL FLYING CAMERA OF<br/>USA CYCLING TEAM</p>",
356
- "tag": "h3",
357
- "text_color": "#ffffff",
358
- "pc_align": "left",
359
- "mobile_align": "center",
360
-
361
- },
362
- },
363
- {
364
- "type": "zz-button",
365
- "settings": {
366
- "text": "Buy Now",
367
- "function_type": "link_map",
368
- "type": "primary",
369
- "color": "white",
370
- "size": "medium"
371
- },
372
- },
373
-
374
- ]
375
- },
376
- {
377
- "type": "zz-flex-layout-bg-block",
378
- "settings": {
379
- "background_color": "rgba(0,0,0,0)",
380
- "bg_type": "image",
381
- "full_screen_bg": true,
382
- "pc_background_image": "shopify://shop_images/preset_pc_full_bg_pic.png",
383
- "mobile_background_image": "shopify://shop_images/preset_mobile_full_bg_pic.png",
384
- "pc_background_video_url": "",
385
- "video_loop": false,
386
- "pc_direction": "column",
387
- "pc_gap": 40,
388
- "pc_justify": "center",
389
- "pc_align": "flex-start",
390
- "pc_padding_top": 0,
391
- "pc_padding_bottom": 0,
392
- "pc_full_width": false,
393
- "pc_xl_width": 1200,
394
- "pc_lg_width": 90,
395
- "mobile_direction": "column",
396
- "mobile_gap": 20,
397
- "mobile_justify": "flex-end",
398
- "mobile_align": "center",
399
- "mobile_padding_bottom": 100,
400
- },
401
- "blocks": [
402
- {
403
- "type": "zz-responsive-width-image",
404
- "settings": {
405
- "desktop_image": "shopify://shop_images/1_521b8e7f-8da9-4df0-9ee1-10a25ee62323.png",
406
- "desktop_width_xl": 322,
407
- "desktop_width_lg": 322,
408
- "desktop_border_radius": 0,
409
- "mobile_image": "shopify://shop_images/12_5bbff2ea-19fe-46e1-944b-f78a79ae2d4a.png",
410
- "mb_width_type": "mb_use_padding",
411
- "mobile_padding_x": 60,
412
- "mobile_width": 60,
413
- "mb_width_px": 100,
414
- "mobile_border_radius": 0,
415
- "alt": "image loading",
416
- },
417
- },
418
- {
419
- "type": "zz-title",
420
- "settings": {
421
- "pc_title": "<p>OFFICIAL FLYING CAMERA OF<br/>USA CYCLING TEAM</p>",
422
- "mb_title": "<p>OFFICIAL FLYING CAMERA OF<br/>USA CYCLING TEAM</p>",
423
- "tag": "h3",
424
- "text_color": "#ffffff",
425
- "pc_align": "left",
426
- "mobile_align": "center",
427
-
428
- },
429
- },
430
- {
431
- "type": "zz-button",
432
- "settings": {
433
- "text": "Buy Now",
434
- "function_type": "link_map",
435
- "type": "primary",
436
- "color": "white",
437
- "size": "medium"
438
- },
439
- },
440
-
441
- ]
442
- }
443
- ]
444
- }
445
- ]
446
- }
447
- {% endschema %}
1
+ {% assign block_size = block.blocks.size %}
2
+
3
+
4
+
5
+ <style>
6
+ #shopify-block-{{block.id}} {
7
+ background: {{ block.settings.bg_color }};
8
+ width: 100vw;
9
+ height: 100vh;
10
+ box-sizing: border-box;
11
+ overflow: hidden;
12
+ position: relative;
13
+ }
14
+ #shopify-block-{{block.id}} .zz-full-screen-swiper {
15
+ width: 100vw;
16
+ height: 100vh;
17
+ box-sizing: border-box;
18
+ overflow: hidden;
19
+ height: fit-content;
20
+ position: relative;
21
+ letter-spacing: 0;
22
+ }
23
+
24
+
25
+ #shopify-block-{{block.id}} .swiper-button-next:after,
26
+ #shopify-block-{{block.id}} .swiper-button-prev:after {
27
+ display: none;
28
+ }
29
+ #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets {
30
+ bottom: 30px;
31
+ }
32
+
33
+ #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
34
+ margin: 0 4px;
35
+ width: 24px;
36
+ height: 3px;
37
+ border-radius: 3px;
38
+ background: {{ block.settings.pagination_color | color_modify: 'alpha', 0.3 }};
39
+ opacity: 1;
40
+ transition: 0.3s;
41
+ }
42
+ #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active {
43
+ position: relative;
44
+ width: 48px;
45
+ }
46
+ #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active .progress-line {
47
+ display: block;
48
+ position: absolute;
49
+ left: 0;
50
+ top: 0;
51
+ width: 0;
52
+ background-color: {{ block.settings.pagination_color }};
53
+ border-radius: 3px;
54
+ height: 3px;
55
+ }
56
+
57
+ @media screen and (max-width: 1023px) {
58
+ #shopify-block-{{block.id}} .swiper-button-next,
59
+ #shopify-block-{{block.id}} .swiper-button-prev {
60
+ display: none;
61
+ }
62
+ }
63
+ @media screen and (min-width: 1024px) {
64
+
65
+ #shopify-block-{{block.id}} .swiper-button-next,
66
+ #shopify-block-{{block.id}} .swiper-button-prev {
67
+ width: 48px;
68
+ height: 48px;
69
+ }
70
+ #shopify-block-{{block.id}} .swiper-button-prev {
71
+ left: 20px;
72
+ top: 50%;
73
+ right: unset;
74
+ transform:translateY(-50%);
75
+ }
76
+ #shopify-block-{{block.id}} .swiper-button-next {
77
+ right: 20px;
78
+ left: unset;
79
+ top: 50%;
80
+ transform:translateY(-50%);
81
+ }
82
+ #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
83
+ margin: 0 8px;
84
+ width: 48px;
85
+ height: 4px;
86
+ border-radius: 3px;
87
+ }
88
+ #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active {
89
+ width: 120px;
90
+ }
91
+ #shopify-block-{{block.id}} .zz-full-screen-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active .progress-line {
92
+ height: 4px;
93
+ border-radius: 3px;
94
+ }
95
+ }
96
+
97
+ </style>
98
+
99
+
100
+
101
+ <div
102
+ class='zz-full-screen-swiper zz-full-screen-swiper-{{ block.id }}'
103
+ >
104
+ <div class='zz-swiper-wrapper'>
105
+ {% content_for 'blocks' %}
106
+ </div>
107
+
108
+ <!-- If we need navigation buttons -->
109
+ <div class='swiper-button-prev {% if block_size <= 1 %} tw-hidden {% endif %}'>
110
+
111
+ {% render 'zz-prev-next-btn', type: 'prev', color_type: block.settings.prev_next_type %}
112
+ </div>
113
+ <div class='swiper-button-next {% if block_size <= 1 %} tw-hidden {% endif %}'>
114
+ {% render 'zz-prev-next-btn', type: 'next', color_type: block.settings.prev_next_type %}
115
+ </div>
116
+
117
+ <!-- Pagination indicator -->
118
+ <div class='swiper-pagination'></div>
119
+ </div>
120
+
121
+
122
+ <script>
123
+
124
+ document.addEventListener('DOMContentLoaded', function () {
125
+ const block = document.getElementById(
126
+ 'shopify-block-{{block.id}}'
127
+ );
128
+
129
+ const swiperWrapper = block.querySelector('.zz-swiper-wrapper');
130
+ // 获取当前 swiper-wrapper 下面 所有 第一层 div
131
+ const swiperSlides = swiperWrapper.querySelectorAll(':scope > div');
132
+ // 给每个 swiper-slide 添加 class swiper-slide
133
+ swiperSlides.forEach(slide => {
134
+ slide.classList.add('swiper-slide');
135
+ });
136
+ swiperWrapper.classList.add('swiper-wrapper');
137
+ let progressTimer = null;
138
+ const swiperClassName = '.zz-full-screen-swiper-{{ block.id }}';
139
+ const fullScreenSwiper = new Swiper(swiperClassName, {
140
+ loop: true,
141
+ slidesPerView: 1,
142
+ centeredSlides: true,
143
+ navigation: {
144
+ nextEl: '.swiper-button-next',
145
+ prevEl: '.swiper-button-prev',
146
+ },
147
+ pagination: {
148
+ el: '.swiper-pagination',
149
+ clickable: true,
150
+ renderBullet: function (index, className) {
151
+ return `
152
+ <span class="${className}">
153
+ <span class="progress-line"></span>
154
+ </span>`;
155
+ },
156
+ },
157
+ effect: 'slide',
158
+ on: {
159
+ slideChangeTransitionEnd: function () {
160
+ block.querySelectorAll(".swiper-pagination-bullet").forEach((bullet) => {
161
+ console.log('do reset')
162
+ const progressBar = bullet.querySelector(".progress-line");
163
+ progressBar.style.transition = "none";
164
+ progressBar.style.width = "0";
165
+ });
166
+ handleVideoOnSlideChange();
167
+ },
168
+ slideChangeTransitionStart: function () {
169
+ console.log('do slideChangeTransitionStart')
170
+ if (progressTimer) {
171
+ clearInterval(progressTimer);
172
+ }
173
+ },
174
+ },
175
+ });
176
+ handleVideoOnSlideChange();
177
+
178
+
179
+ function getVisibleDisplayMedias(container) {
180
+ const videos = container.querySelectorAll('video');
181
+ const video = Array.from(videos).find((video) => {
182
+ const style = window.getComputedStyle(video);
183
+ return style.display !== 'none';
184
+ });
185
+ if (video) {
186
+ return {
187
+ video,
188
+ type: 'video'
189
+ }
190
+ } else {
191
+ const images = container.querySelectorAll('img');
192
+ const image = Array.from(images).find((image) => {
193
+ const style = window.getComputedStyle(image);
194
+ return style.display !== 'none';
195
+ });
196
+ if (image) {
197
+ return {
198
+ image,
199
+ type: 'image'
200
+ }
201
+ }
202
+ }
203
+ return null;
204
+ }
205
+ const endedHandler = function() {
206
+
207
+ fullScreenSwiper.slideNext();
208
+ if (progressTimer) {
209
+ clearInterval(progressTimer);
210
+ }
211
+ this.removeEventListener('ended', endedHandler);
212
+ };
213
+
214
+ function updataMediaProgress(type, videoDom) {
215
+ console.log('do updataMediaProgress')
216
+ const activeBullet = block.querySelector(".swiper-pagination-bullet-active");
217
+ const progressBar = activeBullet.querySelector(".progress-line");
218
+ if (progressBar) {
219
+ if (type === 'video') {
220
+ if (progressTimer) {
221
+ clearInterval(progressTimer);
222
+ }
223
+ // 添加新的事件监听器
224
+ progressTimer = setInterval(() => {
225
+ const progress = videoDom.currentTime / videoDom.duration;
226
+ progressBar.style.transition = "0.2s";
227
+ progressBar.style.width = `${progress * 100}%`;
228
+ }, 100);
229
+ videoDom.addEventListener('ended', endedHandler);
230
+ } else if (type === 'image') {
231
+ console.log('do animate')
232
+ progressBar.style.transition = "15s";
233
+ progressBar.style.width = "100%";
234
+ setTimeout(() => {
235
+ fullScreenSwiper.slideNext();
236
+ }, 15000);
237
+ }
238
+ }
239
+ }
240
+
241
+ function handleVideoOnSlideChange() {
242
+
243
+ const activeSlide = block.querySelector('.swiper-slide-active');
244
+ const media = getVisibleDisplayMedias(activeSlide);
245
+ const activeBullet = block.querySelector(".swiper-pagination-bullet-active");
246
+ const progressBar = activeBullet.querySelector(".progress-line");
247
+ if (progressBar) {
248
+ console.log('do reset 1')
249
+ progressBar.style.transition = "none";
250
+ progressBar.style.width = "0";
251
+ }
252
+ if (media.type === 'video') {
253
+ media.video.currentTime = 0;
254
+ updataMediaProgress('video', media.video);
255
+ } else if (media.type === 'image') {
256
+ // 处理图片的情况
257
+ updataMediaProgress('image', media.image);
258
+ }
259
+ }
260
+ });
261
+ </script>
262
+
263
+ {% schema %}
264
+ {
265
+ "name": "Full Screen Swiper",
266
+ "class": "zz-full-screen-swiper-block",
267
+ "settings": [
268
+ {
269
+ "type": "color",
270
+ "id": "bg_color",
271
+ "default": "#ffffff",
272
+ "label": "背景色"
273
+ },
274
+
275
+ {
276
+ "type": "color",
277
+ "id": "pagination_color",
278
+ "default": "#ffffff",
279
+ "label": "轮播导航圆圈颜色"
280
+ },
281
+ {
282
+ "type": "select",
283
+ "id": "prev_next_type",
284
+ "label": "prev next 颜色",
285
+ "options": [
286
+ { "value": "dark", "label": "黑色" },
287
+ { "value": "light", "label": "白色" },
288
+ ],
289
+ "default": "dark"
290
+ },
291
+ ],
292
+ "blocks": [
293
+ {
294
+ "type": "zz-flex-layout-bg-block",
295
+ }
296
+ ],
297
+ "presets": [
298
+ {
299
+ "name": "Full Screen Swiper",
300
+ },
301
+ {
302
+ "name": "全屏轮播组件",
303
+ "settings": {
304
+ "bg_color": "#ffffff",
305
+ "pagination_color": "#ffffff",
306
+ "prev_next_type": "dark"
307
+ },
308
+ "blocks": [
309
+ {
310
+ "type": "zz-flex-layout-bg-block",
311
+ "settings": {
312
+ "background_color": "rgba(0,0,0,0)",
313
+ "bg_type": "image",
314
+ "full_screen_bg": true,
315
+ "pc_background_image": "shopify://shop_images/preset_pc_full_bg_pic.png",
316
+ "mobile_background_image": "shopify://shop_images/preset_mobile_full_bg_pic.png",
317
+ "pc_background_video_url": "",
318
+ "video_loop": false,
319
+ "pc_direction": "column",
320
+ "pc_gap": 40,
321
+ "pc_justify": "center",
322
+ "pc_align": "flex-start",
323
+ "pc_padding_top": 0,
324
+ "pc_padding_bottom": 0,
325
+ "pc_full_width": false,
326
+ "pc_xl_width": 1200,
327
+ "pc_lg_width": 90,
328
+ "mobile_direction": "column",
329
+ "mobile_gap": 20,
330
+ "mobile_justify": "flex-end",
331
+ "mobile_align": "center",
332
+ "mobile_padding_bottom": 100,
333
+ },
334
+ "blocks": [
335
+ {
336
+ "type": "zz-responsive-width-image",
337
+ "settings": {
338
+ "desktop_image": "shopify://shop_images/1_521b8e7f-8da9-4df0-9ee1-10a25ee62323.png",
339
+ "desktop_width_xl": 322,
340
+ "desktop_width_lg": 322,
341
+ "desktop_border_radius": 0,
342
+ "mobile_image": "shopify://shop_images/12_5bbff2ea-19fe-46e1-944b-f78a79ae2d4a.png",
343
+ "mb_width_type": "mb_use_padding",
344
+ "mobile_padding_x": 60,
345
+ "mobile_width": 60,
346
+ "mb_width_px": 100,
347
+ "mobile_border_radius": 0,
348
+ "alt": "image loading",
349
+ },
350
+ },
351
+ {
352
+ "type": "zz-title",
353
+ "settings": {
354
+ "pc_title": "<p>OFFICIAL FLYING CAMERA OF<br/>USA CYCLING TEAM</p>",
355
+ "mb_title": "<p>OFFICIAL FLYING CAMERA OF<br/>USA CYCLING TEAM</p>",
356
+ "tag": "h3",
357
+ "text_color": "#ffffff",
358
+ "pc_align": "left",
359
+ "mobile_align": "center",
360
+
361
+ },
362
+ },
363
+ {
364
+ "type": "zz-button",
365
+ "settings": {
366
+ "text": "Buy Now",
367
+ "function_type": "link_map",
368
+ "type": "primary",
369
+ "color": "white",
370
+ "size": "medium"
371
+ },
372
+ },
373
+
374
+ ]
375
+ },
376
+ {
377
+ "type": "zz-flex-layout-bg-block",
378
+ "settings": {
379
+ "background_color": "rgba(0,0,0,0)",
380
+ "bg_type": "image",
381
+ "full_screen_bg": true,
382
+ "pc_background_image": "shopify://shop_images/preset_pc_full_bg_pic.png",
383
+ "mobile_background_image": "shopify://shop_images/preset_mobile_full_bg_pic.png",
384
+ "pc_background_video_url": "",
385
+ "video_loop": false,
386
+ "pc_direction": "column",
387
+ "pc_gap": 40,
388
+ "pc_justify": "center",
389
+ "pc_align": "flex-start",
390
+ "pc_padding_top": 0,
391
+ "pc_padding_bottom": 0,
392
+ "pc_full_width": false,
393
+ "pc_xl_width": 1200,
394
+ "pc_lg_width": 90,
395
+ "mobile_direction": "column",
396
+ "mobile_gap": 20,
397
+ "mobile_justify": "flex-end",
398
+ "mobile_align": "center",
399
+ "mobile_padding_bottom": 100,
400
+ },
401
+ "blocks": [
402
+ {
403
+ "type": "zz-responsive-width-image",
404
+ "settings": {
405
+ "desktop_image": "shopify://shop_images/1_521b8e7f-8da9-4df0-9ee1-10a25ee62323.png",
406
+ "desktop_width_xl": 322,
407
+ "desktop_width_lg": 322,
408
+ "desktop_border_radius": 0,
409
+ "mobile_image": "shopify://shop_images/12_5bbff2ea-19fe-46e1-944b-f78a79ae2d4a.png",
410
+ "mb_width_type": "mb_use_padding",
411
+ "mobile_padding_x": 60,
412
+ "mobile_width": 60,
413
+ "mb_width_px": 100,
414
+ "mobile_border_radius": 0,
415
+ "alt": "image loading",
416
+ },
417
+ },
418
+ {
419
+ "type": "zz-title",
420
+ "settings": {
421
+ "pc_title": "<p>OFFICIAL FLYING CAMERA OF<br/>USA CYCLING TEAM</p>",
422
+ "mb_title": "<p>OFFICIAL FLYING CAMERA OF<br/>USA CYCLING TEAM</p>",
423
+ "tag": "h3",
424
+ "text_color": "#ffffff",
425
+ "pc_align": "left",
426
+ "mobile_align": "center",
427
+
428
+ },
429
+ },
430
+ {
431
+ "type": "zz-button",
432
+ "settings": {
433
+ "text": "Buy Now",
434
+ "function_type": "link_map",
435
+ "type": "primary",
436
+ "color": "white",
437
+ "size": "medium"
438
+ },
439
+ },
440
+
441
+ ]
442
+ }
443
+ ]
444
+ }
445
+ ]
446
+ }
447
+ {% endschema %}