zz-shopify-components 0.0.1-beta.1
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/README.md +12 -0
- package/assets/fade-in-content.js +169 -0
- package/assets/gsap.min.js +11 -0
- package/assets/http-request.js +73 -0
- package/assets/jquery.js +2 -0
- package/assets/lozad.js +10 -0
- package/assets/site-jump.js +52 -0
- package/assets/site-jumpV2.js +35 -0
- package/assets/swiper-bundle.min.css +13 -0
- package/assets/swiper-bundle.min.js +14 -0
- package/assets/swiper.css +331 -0
- package/assets/zz-components.css +323 -0
- package/assets/zz-components.js +166 -0
- package/blocks/zz-accessories-item.liquid +183 -0
- package/blocks/zz-accessories-swiper.liquid +223 -0
- package/blocks/zz-button.liquid +189 -0
- package/blocks/zz-content-description-html.liquid +199 -0
- package/blocks/zz-content-description.liquid +200 -0
- package/blocks/zz-flex-layout-bg-block.liquid +520 -0
- package/blocks/zz-flex-layout-block.liquid +545 -0
- package/blocks/zz-flex-layout-widget.liquid +318 -0
- package/blocks/zz-full-screen-swiper.liquid +444 -0
- package/blocks/zz-icon.liquid +46 -0
- package/blocks/zz-mail.liquid +135 -0
- package/blocks/zz-mb-swiper-pc-flex.liquid +270 -0
- package/blocks/zz-ratio-image.liquid +177 -0
- package/blocks/zz-ratio-video.liquid +112 -0
- package/blocks/zz-responsive-width-image.liquid +219 -0
- package/blocks/zz-responsive-width-video.liquid +163 -0
- package/blocks/zz-scroll-animate-bg-text.liquid +265 -0
- package/blocks/zz-scroll-cover.liquid +64 -0
- package/blocks/zz-tag.liquid +48 -0
- package/blocks/zz-text.liquid +225 -0
- package/blocks/zz-title.liquid +284 -0
- package/blocks/zz-video-button.liquid +81 -0
- package/blocks/zz-video-swiper-perview-item.liquid +216 -0
- package/blocks/zz-video-swiper-perview.liquid +582 -0
- package/component.config.json +4 -0
- package/package.json +23 -0
- package/scripts/postinstall-v2.js +47 -0
- package/scripts/postinstall.js +39 -0
- package/sections/zz-flex-layout-section.liquid +266 -0
- package/sections/zz-navigation-tab-v3.liquid +403 -0
- package/sections/zz-navigation-tab.liquid +410 -0
- package/sections/zz-video-collapse-swiper.liquid +522 -0
- package/sections/zz-video-tab-swiper.liquid +745 -0
- package/snippets/zz-button.liquid +70 -0
- package/snippets/zz-content-text.liquid +56 -0
- package/snippets/zz-h2.liquid +31 -0
- package/snippets/zz-h3.liquid +31 -0
- package/snippets/zz-h4.liquid +30 -0
- package/snippets/zz-h5.liquid +39 -0
- package/snippets/zz-h6.liquid +39 -0
- package/snippets/zz-icon.liquid +74 -0
- package/snippets/zz-img.liquid +44 -0
- package/snippets/zz-prev-next-btn.liquid +62 -0
- package/snippets/zz-spoke.liquid +142 -0
- package/snippets/zz-tag.liquid +22 -0
- package/snippets/zz-video-button.liquid +55 -0
- package/snippets/zz-video-md.liquid +117 -0
- package/snippets/zz-video.liquid +117 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
{% schema %}
|
|
2
|
+
{
|
|
3
|
+
"name": "ZZ Flex Layout Section",
|
|
4
|
+
"tag": "section",
|
|
5
|
+
"settings": [
|
|
6
|
+
{
|
|
7
|
+
"type": "color_background",
|
|
8
|
+
"id": "background_color",
|
|
9
|
+
"label": "背景颜色",
|
|
10
|
+
"default": "transparent"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "select",
|
|
14
|
+
"id": "animation",
|
|
15
|
+
"label": "子元素动画",
|
|
16
|
+
"options": [
|
|
17
|
+
{ "value": "none-animation", "label": "无动画" },
|
|
18
|
+
{ "value": "fade-in-box", "label": "按序从下往上显示" },
|
|
19
|
+
{ "value": "fade-in-from-left", "label": "按序从左进入显示" },
|
|
20
|
+
{ "value": "fade-in-from-right", "label": "按序从右进入显示" },
|
|
21
|
+
{ "value": "slow-reveal", "label": "跟随页面滚动缓慢显示" }
|
|
22
|
+
],
|
|
23
|
+
"default": "none-animation"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"type": "header",
|
|
27
|
+
"content": "💻 PC端布局设置"
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
{
|
|
31
|
+
"type": "select",
|
|
32
|
+
"id": "pc_direction",
|
|
33
|
+
"label": "PC方向 (Direction)",
|
|
34
|
+
"options": [
|
|
35
|
+
{ "value": "row", "label": "横向 (Horizontal)" },
|
|
36
|
+
{ "value": "column", "label": "纵向 (Vertical)" },
|
|
37
|
+
{ "value": "row-reverse", "label": "横向反向 (Horizontal Reverse)" },
|
|
38
|
+
{ "value": "column-reverse", "label": "纵向反向 (Vertical Reverse)" }
|
|
39
|
+
],
|
|
40
|
+
"default": "column"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"type": "number",
|
|
44
|
+
"id": "pc_gap",
|
|
45
|
+
"label": "区块间距 (Gap)",
|
|
46
|
+
"default": 0
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
{
|
|
50
|
+
"type": "select",
|
|
51
|
+
"id": "pc_justify",
|
|
52
|
+
"label": "PC主轴对齐 (Justify Content)",
|
|
53
|
+
"options": [
|
|
54
|
+
{ "value": "flex-start", "label": "起始对齐 (Flex Start)" },
|
|
55
|
+
{ "value": "center", "label": "居中对齐 (Center)" },
|
|
56
|
+
{ "value": "flex-end", "label": "末尾对齐 (Flex End)" },
|
|
57
|
+
{ "value": "space-between", "label": "两端对齐 (Space Between)" },
|
|
58
|
+
{ "value": "space-around", "label": "平均间距 (Space Around)" }
|
|
59
|
+
],
|
|
60
|
+
"default": "flex-start"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"type": "select",
|
|
64
|
+
"id": "pc_align",
|
|
65
|
+
"label": "PC交叉轴对齐 (Align Items)",
|
|
66
|
+
"options": [
|
|
67
|
+
{ "value": "flex-start", "label": "起始对齐 (Flex Start)" },
|
|
68
|
+
{ "value": "center", "label": "居中对齐 (Center)" },
|
|
69
|
+
{ "value": "flex-end", "label": "末尾对齐 (Flex End)" }
|
|
70
|
+
],
|
|
71
|
+
"default": "center"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"type": "number",
|
|
75
|
+
"id": "pc_padding_top",
|
|
76
|
+
"label": "PC端上内边距 (px)",
|
|
77
|
+
"default": 80
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"type": "number",
|
|
81
|
+
"id": "pc_padding_bottom",
|
|
82
|
+
"label": "PC端下内边距 (px)",
|
|
83
|
+
"default": 80
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"type": "checkbox",
|
|
87
|
+
"id": "pc_full_width",
|
|
88
|
+
"label": "是否全屏展示",
|
|
89
|
+
"default": false
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"type": "number",
|
|
93
|
+
"id": "pc_xl_width",
|
|
94
|
+
"label": "XL屏幕内容区域宽度 (px)",
|
|
95
|
+
"default": 1200,
|
|
96
|
+
"info": "非全屏展示时有效",
|
|
97
|
+
"visible_if": "{{ section.settings.pc_full_width == false }}"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"type": "number",
|
|
101
|
+
"id": "pc_lg_width",
|
|
102
|
+
"label": "LG屏幕内容区域宽度 (vw)",
|
|
103
|
+
"default": 90,
|
|
104
|
+
"info": "非全屏展示时有效",
|
|
105
|
+
"visible_if": "{{ section.settings.pc_full_width == false }}"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"type": "header",
|
|
109
|
+
"content": "📱 移动端布局设置"
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
{
|
|
113
|
+
"type": "select",
|
|
114
|
+
"id": "mobile_direction",
|
|
115
|
+
"label": "移动方向 (Direction)",
|
|
116
|
+
"options": [
|
|
117
|
+
{ "value": "row", "label": "横向 (Horizontal)" },
|
|
118
|
+
{ "value": "column", "label": "纵向 (Vertical)" },
|
|
119
|
+
{ "value": "row-reverse", "label": "横向反向 (Horizontal Reverse)" },
|
|
120
|
+
{ "value": "column-reverse", "label": "纵向反向 (Vertical Reverse)" }
|
|
121
|
+
],
|
|
122
|
+
"default": "column"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"type": "number",
|
|
126
|
+
"id": "mobile_gap",
|
|
127
|
+
"label": "移动区块间距 (Gap)",
|
|
128
|
+
"default": 0
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"type": "select",
|
|
132
|
+
"id": "mobile_justify",
|
|
133
|
+
"label": "移动主轴对齐 (Justify Content)",
|
|
134
|
+
"options": [
|
|
135
|
+
{ "value": "flex-start", "label": "起始对齐 (Flex Start)" },
|
|
136
|
+
{ "value": "center", "label": "居中对齐 (Center)" },
|
|
137
|
+
{ "value": "flex-end", "label": "末尾对齐 (Flex End)" },
|
|
138
|
+
{ "value": "space-between", "label": "两端对齐 (Space Between)" },
|
|
139
|
+
{ "value": "space-around", "label": "平均间距 (Space Around)" }
|
|
140
|
+
],
|
|
141
|
+
"default": "flex-start"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"type": "select",
|
|
145
|
+
"id": "mobile_align",
|
|
146
|
+
"label": "移动交叉轴对齐 (Align Items)",
|
|
147
|
+
"options": [
|
|
148
|
+
{ "value": "flex-start", "label": "起始对齐 (Flex Start)" },
|
|
149
|
+
{ "value": "center", "label": "居中对齐 (Center)" },
|
|
150
|
+
{ "value": "flex-end", "label": "末尾对齐 (Flex End)" }
|
|
151
|
+
],
|
|
152
|
+
"default": "center"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"type": "number",
|
|
156
|
+
"id": "mobile_padding_top",
|
|
157
|
+
"label": "移动端上内边距 (px)",
|
|
158
|
+
"default": 40
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"type": "number",
|
|
162
|
+
"id": "mobile_padding_bottom",
|
|
163
|
+
"label": "移动端下内边距 (px)",
|
|
164
|
+
"default": 40
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"type": "number",
|
|
168
|
+
"id": "mobile_padding_x",
|
|
169
|
+
"label": "移动端左右内边距",
|
|
170
|
+
"default": 20,
|
|
171
|
+
"info": "单位:px"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"type": "number",
|
|
175
|
+
"id": "top_offset",
|
|
176
|
+
"label": "向上偏移量",
|
|
177
|
+
"default": 0,
|
|
178
|
+
"info": "单位:px,正数,首屏时候会用到"
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
{
|
|
182
|
+
"type": "text",
|
|
183
|
+
"id": "module_name",
|
|
184
|
+
"label": "模块id",
|
|
185
|
+
"info": "用于定位到本模块"
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
"blocks": [
|
|
189
|
+
{
|
|
190
|
+
"type": "@theme",
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"presets": [
|
|
194
|
+
{
|
|
195
|
+
"name": "弹性布局容器",
|
|
196
|
+
"blocks": [
|
|
197
|
+
{
|
|
198
|
+
"type": "zz-title",
|
|
199
|
+
"settings": {
|
|
200
|
+
"pc_title": "<p>Block容器,添加Blcok拼搭组件</p>",
|
|
201
|
+
"mb_title": "<p>Block容器,添加Blcok拼搭组件</p>",
|
|
202
|
+
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
{% endschema %}
|
|
210
|
+
|
|
211
|
+
<style>
|
|
212
|
+
#shopify-section-{{ section.id }} {
|
|
213
|
+
background-color: {{ section.settings.background_color }};
|
|
214
|
+
{% if section.settings.top_offset != 0 %}
|
|
215
|
+
margin-top: -{{ section.settings.top_offset }}px;
|
|
216
|
+
{% endif %}
|
|
217
|
+
{% comment %} {% if section.settings.is_overflow_hidden %}
|
|
218
|
+
overflow-x: hidden;
|
|
219
|
+
{% endif %} {% endcomment %}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
#shopify-section-{{ section.id }} .responsive-section-layout {
|
|
223
|
+
display: flex;
|
|
224
|
+
flex-direction: {{ section.settings.mobile_direction }};
|
|
225
|
+
justify-content: {{ section.settings.mobile_justify }};
|
|
226
|
+
align-items: {{ section.settings.mobile_align }};
|
|
227
|
+
gap: {{ section.settings.mobile_gap }}px;
|
|
228
|
+
padding-top: {{ section.settings.mobile_padding_top }}px;
|
|
229
|
+
padding-bottom: {{ section.settings.mobile_padding_bottom }}px;
|
|
230
|
+
padding-left: {{ section.settings.mobile_padding_x }}px;
|
|
231
|
+
padding-right: {{ section.settings.mobile_padding_x }}px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@media (min-width: 1024px) {
|
|
235
|
+
#shopify-section-{{ section.id }} .responsive-section-layout {
|
|
236
|
+
flex-direction: {{ section.settings.pc_direction }};
|
|
237
|
+
justify-content: {{ section.settings.pc_justify }};
|
|
238
|
+
align-items: {{ section.settings.pc_align }};
|
|
239
|
+
gap: {{ section.settings.pc_gap }}px;
|
|
240
|
+
padding-top: {{ section.settings.pc_padding_top }}px;
|
|
241
|
+
padding-bottom: {{ section.settings.pc_padding_bottom }}px;
|
|
242
|
+
padding-left: 0px;
|
|
243
|
+
padding-right: 0px;
|
|
244
|
+
{% if section.settings.pc_full_width %}
|
|
245
|
+
width: 100%;
|
|
246
|
+
{% else %}
|
|
247
|
+
width: {{ section.settings.pc_lg_width }}vw;
|
|
248
|
+
margin: 0 auto;
|
|
249
|
+
{% endif %}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@media (min-width: 1280px) {
|
|
254
|
+
#shopify-section-{{ section.id }} .responsive-section-layout {
|
|
255
|
+
{% unless section.settings.pc_full_width %}
|
|
256
|
+
width: {{ section.settings.pc_xl_width }}px;
|
|
257
|
+
{% endunless %}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
</style>
|
|
261
|
+
|
|
262
|
+
<div
|
|
263
|
+
class="responsive-section-layout {{ section.settings.animation }}"
|
|
264
|
+
{% if section.settings.module_name != blank %}data-zz-module-name="{{ section.settings.module_name }}"{% endif %}>
|
|
265
|
+
{% content_for 'blocks' %}
|
|
266
|
+
</div>
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
|
|
2
|
+
{% schema %}
|
|
3
|
+
{
|
|
4
|
+
"name": "Navigation Tab V3",
|
|
5
|
+
"class": "zz-navigation-tab-section",
|
|
6
|
+
"settings": [
|
|
7
|
+
{
|
|
8
|
+
"type": "color_background",
|
|
9
|
+
"id": "background_color",
|
|
10
|
+
"label": "背景颜色",
|
|
11
|
+
"default": "#000000"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"type": "image_picker",
|
|
15
|
+
"id": "icon",
|
|
16
|
+
"label": "icon 图标"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"type": "text",
|
|
20
|
+
"id": "btn_text",
|
|
21
|
+
"label": "按钮文字",
|
|
22
|
+
"default": "Buy Now"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "select",
|
|
26
|
+
"id": "btn_function_type",
|
|
27
|
+
"label": "功能类型",
|
|
28
|
+
"options": [
|
|
29
|
+
{
|
|
30
|
+
"value": "link",
|
|
31
|
+
"label": "链接"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"value": "link_map",
|
|
35
|
+
"label": "多国家映射"
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
"default": "link"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "url",
|
|
42
|
+
"id": "url",
|
|
43
|
+
"label": "按钮链接",
|
|
44
|
+
"visible_if": "{{ section.settings.btn_function_type == 'link' }}"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "textarea",
|
|
48
|
+
"id": "links",
|
|
49
|
+
"label": "Sites Link Map",
|
|
50
|
+
"info": "国家对应链接的表,国家即是国家选择器上显示的字段,国家和路由之间用冒号隔开( 冒号后要加空格)。国家之间换行,“default”为其他未写的默认的链接 EG: Canada: https://hoverair.com/ default: https://hoverair.com/ ",
|
|
51
|
+
"visible_if": "{{ section.settings.btn_function_type == 'link_map' }}"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"type": "text",
|
|
55
|
+
"id": "buy_now_click_event_class_name",
|
|
56
|
+
"label": "buy now 点击事件统计 classname",
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
],
|
|
61
|
+
"blocks": [
|
|
62
|
+
|
|
63
|
+
{
|
|
64
|
+
"type": "module_name",
|
|
65
|
+
"name": "模块名称",
|
|
66
|
+
"settings": [
|
|
67
|
+
{
|
|
68
|
+
"type": "text",
|
|
69
|
+
"id": "text",
|
|
70
|
+
"label": "模块名称",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "text",
|
|
74
|
+
"id": "module_name",
|
|
75
|
+
"label": "模块id",
|
|
76
|
+
"info": "用于定位模块"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"type": "color",
|
|
80
|
+
"id": "text_color",
|
|
81
|
+
"label": "文字颜色",
|
|
82
|
+
"default": "#000000"
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
],
|
|
89
|
+
"presets": [
|
|
90
|
+
{
|
|
91
|
+
"name": "模块导航定位tab栏 V3",
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
{% endschema %}
|
|
97
|
+
|
|
98
|
+
{% assign btn_class = 'zz-button' | append: section.id %}
|
|
99
|
+
|
|
100
|
+
<div class="tw-w-full tw-px-8">
|
|
101
|
+
<div class="zz-navigation-pc-tab max-lg:tw-hidden lg:tw-h-[64px] tw-flex tw-items-center tw-justify-between tw-max-w-[1660px] lg:tw-px-[20px] tw-w-full tw-mx-auto">
|
|
102
|
+
<img
|
|
103
|
+
class="tw-w-[134px] tw-h-[12px]"
|
|
104
|
+
src="{{ section.settings.icon | image_url: width: 200 }}" alt="{{ section.settings.icon.alt }}" width="134" height="12">
|
|
105
|
+
<div class="zz-navigation-pc-item-box tw-flex tw-items-center tw-overflow-x-scroll tw-ml-[40px] tw-pr-[60px]">
|
|
106
|
+
{% for block in section.blocks %}
|
|
107
|
+
<div class="pc-tab-item tw-flex-shrink-0 tw-px-[30px]">
|
|
108
|
+
|
|
109
|
+
<span
|
|
110
|
+
class="zz-navigation-tab-item-text tw-cursor-pointer tw-text-[#9E9E9E] tw-text-[14px] tw-leading-[14px] tw-font-[400]"
|
|
111
|
+
data-target="{{ block.settings.module_name }}"
|
|
112
|
+
>{{ block.settings.text }}</span>
|
|
113
|
+
|
|
114
|
+
</div>
|
|
115
|
+
{% unless forloop.last %}
|
|
116
|
+
<div class="pc-tab-item-last tw-w-[1px] tw-h-[16px] tw-bg-[#9E9E9E]"> </div>
|
|
117
|
+
{% endunless %}
|
|
118
|
+
{% endfor %}
|
|
119
|
+
</div>
|
|
120
|
+
<div class="tw-flex-shrink-0 tw-relative">
|
|
121
|
+
<div class="cover-box tw-absolute tw-top-0 tw-left-[-50px] tw-w-[50px] tw-h-full"> </div>
|
|
122
|
+
{% render 'zz-button',
|
|
123
|
+
href: section.settings.url,
|
|
124
|
+
type: 'primary',
|
|
125
|
+
color: 'white',
|
|
126
|
+
text: section.settings.btn_text,
|
|
127
|
+
size: 'medium',
|
|
128
|
+
class_name: btn_class
|
|
129
|
+
|
|
130
|
+
%}
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<div class="zz-navigation-mobile-tab lg:tw-hidden tw-h-[52px] tw-flex tw-items-center tw-justify-between tw-px-8">
|
|
138
|
+
<div class="mb-navigation-box-item zz-navigation-mb-item-box tw-flex tw-items-center tw-gap-[24px] tw-pr-[120px] tw-h-[52px] tw-overflow-x-scroll">
|
|
139
|
+
{% for block in section.blocks %}
|
|
140
|
+
<div class="pc-tab-item tw-flex-shrink-0">
|
|
141
|
+
|
|
142
|
+
<span
|
|
143
|
+
class="zz-navigation-tab-item-text tw-cursor-pointer tw-text-[#9E9E9E] tw-text-[13px] tw-leading-[13px] tw-font-[400]"
|
|
144
|
+
data-target="{{ block.settings.module_name }}"
|
|
145
|
+
>{{ block.settings.text }}</span>
|
|
146
|
+
|
|
147
|
+
</div>
|
|
148
|
+
{% endfor %}
|
|
149
|
+
</div>
|
|
150
|
+
<div class="tw-flex-shrink-0 tw-relative">
|
|
151
|
+
<div class="cover-box tw-absolute tw-top-0 tw-left-[-40px] tw-w-[40px] tw-h-full"> </div>
|
|
152
|
+
{% render 'zz-button',
|
|
153
|
+
href: section.settings.url,
|
|
154
|
+
type: 'primary',
|
|
155
|
+
color: 'white',
|
|
156
|
+
text: section.settings.btn_text,
|
|
157
|
+
size: 'small',
|
|
158
|
+
class_name: btn_class
|
|
159
|
+
%}
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<script>
|
|
164
|
+
document.addEventListener('DOMContentLoaded', (event) => {
|
|
165
|
+
const isDesktop = window.innerWidth > 1024;
|
|
166
|
+
|
|
167
|
+
function scrollPaginationToCenter() {
|
|
168
|
+
// 获取当前section
|
|
169
|
+
const section = document.getElementById(
|
|
170
|
+
'shopify-section-{{section.id}}'
|
|
171
|
+
);
|
|
172
|
+
const paginationContainer = isDesktop ? section.querySelector('.zz-navigation-pc-item-box') : section.querySelector('.zz-navigation-mb-item-box');
|
|
173
|
+
const activeBullet = paginationContainer.querySelector('.zz-navigation-active-text');
|
|
174
|
+
|
|
175
|
+
if (activeBullet) {
|
|
176
|
+
const containerWidth = paginationContainer.offsetWidth;
|
|
177
|
+
const bulletLeft = activeBullet.offsetLeft;
|
|
178
|
+
const bulletWidth = activeBullet.offsetWidth;
|
|
179
|
+
|
|
180
|
+
// 计算需要滚动的位置,使当前bullet居中
|
|
181
|
+
const scrollPosition = bulletLeft - (containerWidth / 2) + (bulletWidth / 2);
|
|
182
|
+
|
|
183
|
+
paginationContainer.scrollTo({
|
|
184
|
+
left: scrollPosition,
|
|
185
|
+
behavior: 'smooth'
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const currentSection = document.getElementById(
|
|
191
|
+
'shopify-section-{{section.id}}'
|
|
192
|
+
);
|
|
193
|
+
// 获取通知栏以及顶部弹窗 调整sticky的top。id="IPTipsBox",id="zz-quick-announcement-bar-container"
|
|
194
|
+
const iptipsBox = document.getElementById('IPTipsBox');
|
|
195
|
+
const pcDropdowns = document.querySelectorAll('.menu-wrapper');
|
|
196
|
+
const tabs = currentSection.querySelectorAll('.zz-navigation-tab-item-text');
|
|
197
|
+
|
|
198
|
+
const sections = document.querySelectorAll('[data-zz-module-name]');//document.querySelectorAll('.zz-navigation-moudule');
|
|
199
|
+
let showPcDropdowns = []
|
|
200
|
+
// 点击 tab 滚动
|
|
201
|
+
tabs.forEach(tab => {
|
|
202
|
+
tab.addEventListener('click', () => {
|
|
203
|
+
const id = tab.dataset.target;
|
|
204
|
+
const target = document.querySelector(`[data-zz-module-name="${id}"]`);
|
|
205
|
+
const headerHeight = isDesktop ? 64 : 44;
|
|
206
|
+
const offsetTop = target.offsetTop - headerHeight;
|
|
207
|
+
scrollPaginationToCenter();
|
|
208
|
+
window.scrollTo(0, offsetTop);
|
|
209
|
+
dataLayer.push({
|
|
210
|
+
event: "141_productpage_click_header_tab_item",
|
|
211
|
+
timestamp: new Date().toISOString(),
|
|
212
|
+
header_module_name: id,
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// 监听滚动,高亮 tab
|
|
218
|
+
const observerOptions = {
|
|
219
|
+
root: null,
|
|
220
|
+
rootMargin: '0px 0px 0px 0px',
|
|
221
|
+
threshold: 0.1
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const observer = new IntersectionObserver(entries => {
|
|
225
|
+
entries.forEach(entry => {
|
|
226
|
+
if (entry.isIntersecting) {
|
|
227
|
+
const id = entry.target.dataset.zzModuleName;
|
|
228
|
+
tabs.forEach(tab => {
|
|
229
|
+
tab.classList.toggle('zz-navigation-active-text', tab.dataset.target === id);
|
|
230
|
+
scrollPaginationToCenter();
|
|
231
|
+
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
});
|
|
236
|
+
}, observerOptions);
|
|
237
|
+
const headerObserver = new IntersectionObserver(entries => {
|
|
238
|
+
entries.forEach(entry => {
|
|
239
|
+
if (entry.target == iptipsBox) {
|
|
240
|
+
|
|
241
|
+
if (entry.isIntersecting) {
|
|
242
|
+
// 计算iptipsBox的高度,并设置sticky的top
|
|
243
|
+
const iptipsBoxHeight = entry.target.offsetHeight;
|
|
244
|
+
if(isDesktop) {
|
|
245
|
+
currentSection.style.top = iptipsBoxHeight + 'px';
|
|
246
|
+
} else {
|
|
247
|
+
// 后期移动端要加上导航栏的高度 44
|
|
248
|
+
currentSection.style.top = iptipsBoxHeight + 44 + 'px';
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
} else {
|
|
252
|
+
|
|
253
|
+
if(isDesktop) {
|
|
254
|
+
currentSection.style.top = '0px';
|
|
255
|
+
} else {
|
|
256
|
+
currentSection.style.top = '44px';
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
if(entry.isIntersecting) {
|
|
261
|
+
if(!showPcDropdowns.includes(entry.target)) {
|
|
262
|
+
showPcDropdowns.push(entry.target);
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
showPcDropdowns = showPcDropdowns.filter(dropdown => dropdown !== entry.target);
|
|
266
|
+
}
|
|
267
|
+
if(isDesktop) {
|
|
268
|
+
if(showPcDropdowns.length > 0) {
|
|
269
|
+
currentSection.style.zIndex = '490';
|
|
270
|
+
} else {
|
|
271
|
+
currentSection.style.zIndex = '501';
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
});
|
|
277
|
+
}, {
|
|
278
|
+
root: null,
|
|
279
|
+
rootMargin: '0px 0px 0px 0px',
|
|
280
|
+
threshold: 0
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
sections.forEach(section => observer.observe(section));
|
|
285
|
+
headerObserver.observe(iptipsBox);
|
|
286
|
+
pcDropdowns.forEach(dropdown => headerObserver.observe(dropdown));
|
|
287
|
+
function handlePCTouchScroll () {
|
|
288
|
+
const el = document.querySelector('.zz-navigation-pc-item-box');
|
|
289
|
+
let isDown = false;
|
|
290
|
+
let startX, scrollLeft;
|
|
291
|
+
|
|
292
|
+
el.addEventListener('mousedown', e => {
|
|
293
|
+
isDown = true;
|
|
294
|
+
el.classList.add('dragging');
|
|
295
|
+
startX = e.pageX;
|
|
296
|
+
scrollLeft = el.scrollLeft;
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
el.addEventListener('mouseleave', () => isDown = false);
|
|
300
|
+
el.addEventListener('mouseup', () => isDown = false);
|
|
301
|
+
el.addEventListener('mousemove', e => {
|
|
302
|
+
if (!isDown) return;
|
|
303
|
+
e.preventDefault();
|
|
304
|
+
const x = e.pageX;
|
|
305
|
+
const walk = x - startX;
|
|
306
|
+
el.scrollLeft = scrollLeft - walk;
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
handlePCTouchScroll();
|
|
311
|
+
|
|
312
|
+
const btns = document.querySelectorAll('.{{ btn_class }}');
|
|
313
|
+
btns.forEach(btn => {
|
|
314
|
+
btn.addEventListener('click', (event) => {
|
|
315
|
+
dataLayer.push({
|
|
316
|
+
event: "{{ section.settings.buy_now_click_event_class_name }}",
|
|
317
|
+
timestamp: new Date().toISOString(),
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
{% if section.settings.btn_function_type == 'link_map' %}
|
|
321
|
+
bindSiteJump(btn, {{ section.settings.links | json }})
|
|
322
|
+
{% endif %}
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
})
|
|
326
|
+
</script>
|
|
327
|
+
<style>
|
|
328
|
+
#shopify-section-{{ section.id }} {
|
|
329
|
+
position: sticky;
|
|
330
|
+
width: 100%;
|
|
331
|
+
background-color: {{ section.settings.background_color }};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
#shopify-section-{{ section.id }} .zz-navigation-mobile-tab {
|
|
335
|
+
|
|
336
|
+
}
|
|
337
|
+
#shopify-section-{{ section.id }} .zz-navigation-pc-tab {
|
|
338
|
+
width: 100%;
|
|
339
|
+
box-sizing: border-box;
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
}
|
|
343
|
+
#shopify-section-{{ section.id }} .cover-box {
|
|
344
|
+
background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, #000000 100%);
|
|
345
|
+
|
|
346
|
+
}
|
|
347
|
+
#shopify-section-{{ section.id }} .zz-navigation-active-text {
|
|
348
|
+
font-weight: 700;
|
|
349
|
+
color: #FFFFFF;
|
|
350
|
+
}
|
|
351
|
+
#shopify-section-{{ section.id }} .zz-navigation-mobile-tab {
|
|
352
|
+
border-bottom: 0.5px solid #FFFFFF26;
|
|
353
|
+
}
|
|
354
|
+
#shopify-section-{{ section.id }} .{{ btn_class }} {
|
|
355
|
+
flex-shrink: 0;
|
|
356
|
+
}
|
|
357
|
+
@media screen and (min-width: 1024px) {
|
|
358
|
+
#shopify-section-{{ section.id }} {
|
|
359
|
+
z-index: 501;
|
|
360
|
+
top: 0;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
}
|
|
364
|
+
@media screen and (max-width: 1024px) {
|
|
365
|
+
#shopify-section-{{ section.id }} {
|
|
366
|
+
z-index: 499;
|
|
367
|
+
top: 44px;
|
|
368
|
+
}
|
|
369
|
+
#shopify-section-{{ section.id }} .{{ btn_class }} {
|
|
370
|
+
height: 28px;
|
|
371
|
+
padding: 0 16px;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.zz-navigation-pc-item-box {
|
|
376
|
+
overflow-x: auto;
|
|
377
|
+
overflow-y: hidden;
|
|
378
|
+
scrollbar-width: none; /* Firefox */
|
|
379
|
+
-ms-overflow-style: none; /* IE 10+ */
|
|
380
|
+
}
|
|
381
|
+
html {
|
|
382
|
+
scroll-behavior: auto;
|
|
383
|
+
}
|
|
384
|
+
.zz-navigation-pc-item-box::-webkit-scrollbar {
|
|
385
|
+
width: 0;
|
|
386
|
+
height: 0;
|
|
387
|
+
display: none; /* Chrome/Safari/Edge */
|
|
388
|
+
}
|
|
389
|
+
.zz-navigation-mb-item-box {
|
|
390
|
+
overflow-x: auto;
|
|
391
|
+
overflow-y: hidden;
|
|
392
|
+
scrollbar-width: none; /* Firefox */
|
|
393
|
+
-ms-overflow-style: none; /* IE 10+ */
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.zz-navigation-mb-item-box::-webkit-scrollbar {
|
|
397
|
+
width: 0;
|
|
398
|
+
height: 0;
|
|
399
|
+
display: none; /* Chrome/Safari/Edge */
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
</style>
|