zz-shopify-components 0.31.0 → 0.32.0
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/blocks/zz-accessories-item.liquid +1 -1
- package/blocks/zz-normal-swiper.liquid +62 -3
- package/package.json +1 -1
- package/snippets/zz-accessories-preview-swiper.liquid +24 -1
- package/snippets/zz-gallery-tab.liquid +7 -1
- package/snippets/zz-product-preview.liquid +4 -1
- package/snippets/zz-product-video.liquid +4 -0
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
mb_width: 640,
|
|
39
39
|
%}
|
|
40
40
|
</div>
|
|
41
|
-
<div class="lg:tw-h-[110px]">
|
|
41
|
+
<div class="banner-item-content-text lg:tw-h-[110px]">
|
|
42
42
|
<p
|
|
43
43
|
class='slide-title tw-mt-[20px] lg:tw-mt-[30px] tw-mb-[8px] tw-text-[16px] lg:tw-text-[18px] tw-leading-[1.2] tw-text-center tw-font-bold tw-text-black'
|
|
44
44
|
style='color: {{ block.settings.slide_title_color }};'>
|
|
@@ -263,6 +263,13 @@
|
|
|
263
263
|
width: 0%;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
{% if block.settings.enable_long_image_scroll %}
|
|
267
|
+
#shopify-block-{{block.id}} .zz-normal-swiper .swiper-slide {
|
|
268
|
+
width: auto !important;
|
|
269
|
+
display: flex;
|
|
270
|
+
}
|
|
271
|
+
{% endif %}
|
|
272
|
+
|
|
266
273
|
{% if block.settings.slides_per_view_pc == 0 %}
|
|
267
274
|
@media screen and (min-width: 1024px) {
|
|
268
275
|
#shopify-block-{{block.id}} .zz-normal-swiper .swiper-slide {
|
|
@@ -393,13 +400,32 @@
|
|
|
393
400
|
let instance = null;
|
|
394
401
|
let initialized = false;
|
|
395
402
|
|
|
403
|
+
const isDesktop = window.innerWidth > 1023;
|
|
404
|
+
const spaceBetween = isDesktop ? {{ block.settings.space_between | default: 8 }} : {{ block.settings.space_between_mb | default: 8 }};
|
|
405
|
+
|
|
396
406
|
const options = {
|
|
407
|
+
{% if block.settings.enable_long_image_scroll %}
|
|
408
|
+
loop: false,
|
|
409
|
+
{% else %}
|
|
397
410
|
loop: {{ block.settings.loop | json }},
|
|
411
|
+
{% endif %}
|
|
398
412
|
speed: {{ block.settings.speed | default: 500 }},
|
|
399
413
|
autoHeight: {{ block.settings.auto_height | json }},
|
|
400
414
|
centeredSlides: {{ block.settings.centered_slides | json }},
|
|
401
415
|
watchOverflow: true,
|
|
402
|
-
spaceBetween:
|
|
416
|
+
spaceBetween: spaceBetween,
|
|
417
|
+
{% if block.settings.enable_long_image_scroll %}
|
|
418
|
+
freeMode: {
|
|
419
|
+
enabled: true,
|
|
420
|
+
sticky: false,
|
|
421
|
+
momentum: true,
|
|
422
|
+
momentumRatio: 0.8
|
|
423
|
+
},
|
|
424
|
+
slidesPerView: 'auto',
|
|
425
|
+
grabCursor: true,
|
|
426
|
+
{% else %}
|
|
427
|
+
freeMode: false,
|
|
428
|
+
{% endif %}
|
|
403
429
|
{% if block.settings.pagination_type != 'none' %}
|
|
404
430
|
pagination: {
|
|
405
431
|
el: '#shopify-block-{{block.id}} .swiper-pagination',
|
|
@@ -423,7 +449,15 @@
|
|
|
423
449
|
initialSlide: {{ block.settings.pre_show_index | default: 0 }},
|
|
424
450
|
breakpoints: {
|
|
425
451
|
0: {
|
|
426
|
-
{% if block.settings.
|
|
452
|
+
{% if block.settings.enable_long_image_scroll %}
|
|
453
|
+
slidesPerView: 'auto',
|
|
454
|
+
freeMode: {
|
|
455
|
+
enabled: true,
|
|
456
|
+
sticky: false,
|
|
457
|
+
momentum: true
|
|
458
|
+
},
|
|
459
|
+
grabCursor: true,
|
|
460
|
+
{% elsif block.settings.slides_per_view_mb == 0 %}
|
|
427
461
|
slidesPerView: 'auto',
|
|
428
462
|
{% else %}
|
|
429
463
|
slidesPerView: {{ block.settings.slides_per_view_mb | default: 1 }},
|
|
@@ -431,7 +465,15 @@
|
|
|
431
465
|
slidesPerGroup: {{ block.settings.slides_per_group_mb | default: 1 }},
|
|
432
466
|
},
|
|
433
467
|
1024: {
|
|
434
|
-
{% if block.settings.
|
|
468
|
+
{% if block.settings.enable_long_image_scroll %}
|
|
469
|
+
{% comment %} slidesPerView: 'auto', {% endcomment %}
|
|
470
|
+
freeMode: {
|
|
471
|
+
enabled: true,
|
|
472
|
+
sticky: false,
|
|
473
|
+
momentum: true
|
|
474
|
+
},
|
|
475
|
+
grabCursor: true,
|
|
476
|
+
{% elsif block.settings.slides_per_view_pc == 0 %}
|
|
435
477
|
slidesPerView: 'auto',
|
|
436
478
|
{% else %}
|
|
437
479
|
slidesPerView: {{ block.settings.slides_per_view_pc | default: 3 }},
|
|
@@ -498,6 +540,15 @@
|
|
|
498
540
|
"max": 80,
|
|
499
541
|
"step": 2
|
|
500
542
|
},
|
|
543
|
+
{
|
|
544
|
+
"type": "range",
|
|
545
|
+
"id": "space_between_mb",
|
|
546
|
+
"label": "卡片间距(px)(mobile)",
|
|
547
|
+
"default": 8,
|
|
548
|
+
"min": 0,
|
|
549
|
+
"max": 80,
|
|
550
|
+
"step": 2
|
|
551
|
+
},
|
|
501
552
|
{
|
|
502
553
|
"type": "checkbox",
|
|
503
554
|
"id": "centered_slides",
|
|
@@ -627,6 +678,13 @@
|
|
|
627
678
|
"default": "dark"
|
|
628
679
|
},
|
|
629
680
|
|
|
681
|
+
{
|
|
682
|
+
"type": "checkbox",
|
|
683
|
+
"id": "enable_long_image_scroll",
|
|
684
|
+
"label": "启用超长图横向滚动模式",
|
|
685
|
+
"info": "开启后,单张图片可横向滑动查看,常用于超宽全景图。此时请将可见数(Mobile/PC)设置为1。",
|
|
686
|
+
"default": true
|
|
687
|
+
},
|
|
630
688
|
{
|
|
631
689
|
"type": "range",
|
|
632
690
|
"id": "slides_per_view_mb",
|
|
@@ -680,6 +738,7 @@
|
|
|
680
738
|
"loop": true,
|
|
681
739
|
"speed": 500,
|
|
682
740
|
"space_between": 8,
|
|
741
|
+
"space_between_mb": 8,
|
|
683
742
|
"centered_slides": false,
|
|
684
743
|
"auto_height": false,
|
|
685
744
|
"autoplay": false,
|
package/package.json
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
<div class='swiper-wrapper'>
|
|
4
4
|
{% for image in product.metafields.custom.acc_images.value %}
|
|
5
5
|
{% assign accessories_points_index = forloop.index %}
|
|
6
|
-
<div class='swiper-slide tw-flex tw-justify-center tw-relative'
|
|
6
|
+
<div class='swiper-slide tw-flex tw-justify-center tw-relative'
|
|
7
|
+
data-track-zz-block="accessory_swiper_{{ accessories_points_index }}">
|
|
7
8
|
{{
|
|
8
9
|
image
|
|
9
10
|
| image_url: width: 3000
|
|
@@ -27,6 +28,8 @@
|
|
|
27
28
|
data-point-swiper-index='{{ block.settings.swiper_index }}'
|
|
28
29
|
class='product-accessories-point-item tw-absolute tw-rounded-full tw-backdrop-blur-[20px] tw-gap-[12px] tw-flex tw-items-center tw-justify-center tw-bg-[rgba(255,255,255,0.8)] lg:tw-py-[6px] tw-py-[4px] lg:tw-pl-[8px] tw-pl-[4px] tw-pr-[20px] tw-z-50 tw-cursor-pointer'
|
|
29
30
|
style='left: {{ block.settings.point_x }}%; top: {{ block.settings.point_y }}%;'
|
|
31
|
+
data-track-zz-element="accessory_point_add_to_cart_{{ block.settings.accessories_title | replace: ' ', '_' | downcase }}"
|
|
32
|
+
data-track-zz-params="content_name:{{ block.settings.accessories_title }}"
|
|
30
33
|
>
|
|
31
34
|
<svg
|
|
32
35
|
width='36'
|
|
@@ -251,6 +254,26 @@
|
|
|
251
254
|
clickable: true,
|
|
252
255
|
},
|
|
253
256
|
thumbs: { swiper: this._thumbs },
|
|
257
|
+
on: {
|
|
258
|
+
slideChange: function () {
|
|
259
|
+
const activeSlideEl = (this.slides && this.slides[this.activeIndex])
|
|
260
|
+
|| (this.el && this.el.querySelector && this.el.querySelector('.swiper-slide-active'))
|
|
261
|
+
|| null;
|
|
262
|
+
if (activeSlideEl) {
|
|
263
|
+
if(window.zzGetElementHpm) {
|
|
264
|
+
const hpm = window.zzGetElementHpm(activeSlideEl, 'block');
|
|
265
|
+
if(hpm) {
|
|
266
|
+
window.zzAnalytics && zzAnalytics.trackEvent('exposure', {
|
|
267
|
+
page_element: {
|
|
268
|
+
hpm,
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
254
277
|
});
|
|
255
278
|
}
|
|
256
279
|
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
<div
|
|
4
4
|
class='gallery-tab-item active'
|
|
5
5
|
data-test-locator='galleryTabItemPhoto'
|
|
6
|
+
data-track-zz-element="tab_photo"
|
|
6
7
|
data-test-value='photo'
|
|
7
8
|
>
|
|
8
|
-
<div
|
|
9
|
+
<div
|
|
10
|
+
class='gallery-tab-item-text'
|
|
11
|
+
>
|
|
9
12
|
<svg
|
|
10
13
|
xmlns='http://www.w3.org/2000/svg'
|
|
11
14
|
width='16'
|
|
@@ -26,6 +29,7 @@
|
|
|
26
29
|
class='gallery-tab-item'
|
|
27
30
|
data-test-locator='galleryTabItemAccessories'
|
|
28
31
|
data-test-value='accessories'
|
|
32
|
+
data-track-zz-element="tab_accessories"
|
|
29
33
|
>
|
|
30
34
|
<div class='gallery-tab-item-text'>
|
|
31
35
|
<svg
|
|
@@ -48,6 +52,7 @@
|
|
|
48
52
|
class='gallery-tab-item'
|
|
49
53
|
data-test-locator='galleryTabItemVideo'
|
|
50
54
|
data-test-value='video'
|
|
55
|
+
data-track-zz-element="tab_video"
|
|
51
56
|
>
|
|
52
57
|
<div class='gallery-tab-item-text'>
|
|
53
58
|
<svg
|
|
@@ -69,6 +74,7 @@
|
|
|
69
74
|
class='gallery-tab-item'
|
|
70
75
|
data-test-locator='galleryTabItem3D'
|
|
71
76
|
data-test-value='3d'
|
|
77
|
+
data-track-zz-element="tab_3d"
|
|
72
78
|
>
|
|
73
79
|
<div class='gallery-tab-item-text'>
|
|
74
80
|
<svg
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div
|
|
2
|
+
data-track-zz-block="product_buy_left_tab"
|
|
3
|
+
data-track-zz-exposure="true"
|
|
4
|
+
class=' tw-h-full tw-flex tw-flex-col tw-flex-1 tw-relative lg:tw-py-[20px]'>
|
|
2
5
|
<div class='product-container lg:tw-max-h-[721px] tw-flex-1 tw-min-h-0 tw-flex tw-items-center tw-justify-center'>
|
|
3
6
|
{% comment %} 左侧产品预览 {% endcomment %}
|
|
4
7
|
<div
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
<video
|
|
27
27
|
id='product-video-intro-{{ product.id }}'
|
|
28
28
|
data-type='intro'
|
|
29
|
+
data-track-zz-video='introduction_video'
|
|
29
30
|
data-src='{{ intro_video.sources[1].url }}'
|
|
30
31
|
poster='{{ intro_video.preview_image | image_url: width: 1000 }}'
|
|
31
32
|
controls
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
role='tabpanel'
|
|
61
62
|
aria-labelledby='product-video-tab-livestream-{{ product.id }}'
|
|
62
63
|
data-type='livestream'
|
|
64
|
+
data-track-zz-video='livestream_video'
|
|
63
65
|
data-src='{{ livestream_video.sources[0].url }}'
|
|
64
66
|
poster='{{ livestream_video.preview_image | image_url: width: 1000 }}'
|
|
65
67
|
controls
|
|
@@ -99,6 +101,7 @@
|
|
|
99
101
|
data-tab='intro'
|
|
100
102
|
role='tab'
|
|
101
103
|
aria-controls='product-video-intro-{{ product.id }}'
|
|
104
|
+
data-track-zz-element='introduction_btn'
|
|
102
105
|
aria-selected='true'
|
|
103
106
|
>
|
|
104
107
|
Introduction
|
|
@@ -109,6 +112,7 @@
|
|
|
109
112
|
type='button'
|
|
110
113
|
id='product-video-tab-livestream-{{ product.id }}'
|
|
111
114
|
class='product-video-tab-item'
|
|
115
|
+
data-track-zz-element='livestream_btn'
|
|
112
116
|
data-tab='livestream'
|
|
113
117
|
role='tab'
|
|
114
118
|
aria-controls='firework-video-{{ product.id }}'
|