zz-shopify-components 0.36.1-beta.4 → 0.36.1-beta.6
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-scroll-animate-bg-text.liquid +18 -8
- package/blocks/zz-swiper-title-in-item.liquid +40 -20
- package/blocks/zz-text.liquid +7 -1
- package/package.json +1 -1
- package/sections/zz-products-specs.liquid +388 -0
- package/sections/zz-swiper-banner.liquid +1 -1
- package/sections/zz-video-cards.liquid +558 -0
- package/sections/zz-video-tab-swiper.liquid +111 -53
- package/snippets/zz-content-text.liquid +3 -2
|
@@ -20,6 +20,13 @@
|
|
|
20
20
|
"id": "mobile_image",
|
|
21
21
|
"label": "移动端图片"
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
"type": "checkbox",
|
|
25
|
+
"id": "is_compatible",
|
|
26
|
+
"label": "兼容顶部导航栏",
|
|
27
|
+
"default": false,
|
|
28
|
+
"info": "防止顶部导航栏遮住标题"
|
|
29
|
+
},
|
|
23
30
|
{
|
|
24
31
|
"type": "richtext",
|
|
25
32
|
"id": "pc_title",
|
|
@@ -140,7 +147,7 @@
|
|
|
140
147
|
{% render 'zz-img',
|
|
141
148
|
pc_image: block.settings.desktop_image,
|
|
142
149
|
mb_image: block.settings.mobile_image,
|
|
143
|
-
image_alt: block.settings.alt
|
|
150
|
+
image_alt: block.settings.alt,
|
|
144
151
|
class_name: 'tw-w-full tw-h-full tw-object-cover',
|
|
145
152
|
%}
|
|
146
153
|
|
|
@@ -151,7 +158,7 @@
|
|
|
151
158
|
{% when 'h2' %}
|
|
152
159
|
{% render 'zz-h2',
|
|
153
160
|
title: block.settings.pc_title,
|
|
154
|
-
title_mb: block.settings.mb_title
|
|
161
|
+
title_mb: block.settings.mb_title,
|
|
155
162
|
title_color: block.settings.text_color,
|
|
156
163
|
|
|
157
164
|
class_name: 'scroll-animate-bg-title'
|
|
@@ -159,7 +166,7 @@
|
|
|
159
166
|
{% when 'h3' %}
|
|
160
167
|
{% render 'zz-h3',
|
|
161
168
|
title: block.settings.pc_title,
|
|
162
|
-
title_mb: block.settings.mb_title
|
|
169
|
+
title_mb: block.settings.mb_title,
|
|
163
170
|
title_color: block.settings.text_color,
|
|
164
171
|
class_name: 'scroll-animate-bg-title'
|
|
165
172
|
|
|
@@ -167,14 +174,14 @@
|
|
|
167
174
|
{% when 'h4' %}
|
|
168
175
|
{% render 'zz-h4',
|
|
169
176
|
title: block.settings.pc_title,
|
|
170
|
-
title_mb: block.settings.mb_title
|
|
177
|
+
title_mb: block.settings.mb_title,
|
|
171
178
|
title_color: block.settings.text_color,
|
|
172
179
|
class_name: 'scroll-animate-bg-title'
|
|
173
180
|
%}
|
|
174
181
|
{% when 'h5' %}
|
|
175
182
|
{% render 'zz-h5',
|
|
176
183
|
title: block.settings.pc_title,
|
|
177
|
-
title_mb: block.settings.mb_title
|
|
184
|
+
title_mb: block.settings.mb_title,
|
|
178
185
|
title_color: block.settings.text_color,
|
|
179
186
|
class_name: 'scroll-animate-bg-title'
|
|
180
187
|
%}
|
|
@@ -225,9 +232,12 @@
|
|
|
225
232
|
|
|
226
233
|
}
|
|
227
234
|
@media screen and (min-width: 1024px) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
235
|
+
{% if block.settings.is_compatible == true %}
|
|
236
|
+
#shopify-block-{{ block.id }} .scroll-block-scroll-animate {
|
|
237
|
+
padding-top: 50px;
|
|
238
|
+
}
|
|
239
|
+
{% endif %}
|
|
240
|
+
|
|
231
241
|
#shopify-block-{{ block.id }} .text-overlay {
|
|
232
242
|
position: absolute;
|
|
233
243
|
top: {{ block.settings.pc_top }}%;
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
<div class='media-box tw-relative banner-item {{ media_class }}'>
|
|
40
40
|
{% render 'zz-h6',
|
|
41
41
|
title: block.settings.heading,
|
|
42
|
-
|
|
42
|
+
title_mb: block.settings.heading_mb,
|
|
43
|
+
title_color: block.settings.text_color,
|
|
43
44
|
class_name: 'media-box-title tw-text-left max-lg:tw-hidden tw-absolute tw-top-[20px] tw-left-[20px] tw-right-[20px]'
|
|
44
45
|
%}
|
|
45
46
|
{% if block.settings.video_pc != blank %}
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
render 'zz-img',
|
|
66
67
|
pc_image: block.settings.poster_pc,
|
|
67
68
|
mb_image: block.settings.poster_mb,
|
|
68
|
-
image_alt: block.settings.heading
|
|
69
|
+
image_alt: block.settings.heading,
|
|
69
70
|
class_name: 'image-video-box',
|
|
70
71
|
%}
|
|
71
72
|
{% endif %}
|
|
@@ -75,19 +76,38 @@
|
|
|
75
76
|
<div class='active-box-content max-lg:tw-mt-[20px]'>
|
|
76
77
|
{% render 'zz-h5',
|
|
77
78
|
title: block.settings.heading,
|
|
78
|
-
title_color: block.settings.
|
|
79
|
+
title_color: block.settings.text_color,
|
|
79
80
|
class_name: 'tw-text-center lg:tw-hidden !tw-text-[16px]'
|
|
80
81
|
%}
|
|
81
|
-
|
|
82
|
-
{%
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
{% if block.settings.row_content != blank %}
|
|
83
|
+
{% assign content_color = block.settings.text_color | color_modify: 'alpha', 0.7 %}
|
|
84
|
+
<div class='tw-mt-[8px] lg:tw-mt-[16px]'>
|
|
85
|
+
{% render 'zz-content-text',
|
|
86
|
+
text: block.settings.row_content,
|
|
87
|
+
mb_text: block.settings.row_content,
|
|
88
|
+
pc_font_size: 16,
|
|
89
|
+
mobile_font_size: 12,
|
|
90
|
+
text_color: content_color,
|
|
91
|
+
class_name: 'max-lg:tw-text-center lg:tw-text-left',
|
|
92
|
+
%}
|
|
93
|
+
</div>
|
|
94
|
+
{% endif %}
|
|
95
|
+
{% if block.settings.row_content_2 != blank %}
|
|
96
|
+
{% assign content_color_2 = block.settings.text_color
|
|
97
|
+
| color_modify: 'alpha', 0.45
|
|
89
98
|
%}
|
|
90
|
-
|
|
99
|
+
<div class='tw-mt-[8px] lg:tw-mt-[16px]'>
|
|
100
|
+
{% render 'zz-content-text',
|
|
101
|
+
text: block.settings.row_content_2,
|
|
102
|
+
mb_text: block.settings.row_content_2,
|
|
103
|
+
pc_font_size: 14,
|
|
104
|
+
mobile_font_size: 10,
|
|
105
|
+
text_color: content_color_2,
|
|
106
|
+
class_name: 'max-lg:tw-text-center lg:tw-text-left',
|
|
107
|
+
%}
|
|
108
|
+
</div>
|
|
109
|
+
{% endif %}
|
|
110
|
+
|
|
91
111
|
</div>
|
|
92
112
|
|
|
93
113
|
|
|
@@ -123,15 +143,16 @@
|
|
|
123
143
|
"label": "Poster(Mobile)"
|
|
124
144
|
},
|
|
125
145
|
{
|
|
126
|
-
"type": "
|
|
146
|
+
"type": "richtext",
|
|
127
147
|
"id": "heading",
|
|
128
148
|
"label": "标题"
|
|
129
149
|
},
|
|
130
150
|
{
|
|
131
151
|
"type": "color",
|
|
132
|
-
"id": "
|
|
133
|
-
"default": "#
|
|
134
|
-
"label": "
|
|
152
|
+
"id": "text_color",
|
|
153
|
+
"default": "#ffffff",
|
|
154
|
+
"label": "文本颜色",
|
|
155
|
+
"info": "标题颜色,文案根据这个颜色, 70%, 45%透明度"
|
|
135
156
|
},
|
|
136
157
|
{
|
|
137
158
|
"type": "richtext",
|
|
@@ -139,10 +160,9 @@
|
|
|
139
160
|
"label": "description"
|
|
140
161
|
},
|
|
141
162
|
{
|
|
142
|
-
"type": "
|
|
143
|
-
"id": "
|
|
144
|
-
"
|
|
145
|
-
"label": "内容颜色"
|
|
163
|
+
"type": "richtext",
|
|
164
|
+
"id": "row_content_2",
|
|
165
|
+
"label": "description2"
|
|
146
166
|
},
|
|
147
167
|
{
|
|
148
168
|
"type": "text",
|
package/blocks/zz-text.liquid
CHANGED
|
@@ -39,7 +39,12 @@
|
|
|
39
39
|
],
|
|
40
40
|
"default": "400"
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
{
|
|
43
|
+
"type": "checkbox",
|
|
44
|
+
"id": "italic",
|
|
45
|
+
"label": "是否斜体 (Italic)",
|
|
46
|
+
"default": false
|
|
47
|
+
},
|
|
43
48
|
{
|
|
44
49
|
"type": "header",
|
|
45
50
|
"content": "PC Settings"
|
|
@@ -195,6 +200,7 @@
|
|
|
195
200
|
pc_text_align: block.settings.pc_text_align,
|
|
196
201
|
mobile_text_align: block.settings.mobile_text_align,
|
|
197
202
|
font_weight: block.settings.font_weight,
|
|
203
|
+
italic: block.settings.italic,
|
|
198
204
|
class_name: block.settings.animation
|
|
199
205
|
%}
|
|
200
206
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
{%- comment -%}
|
|
2
|
+
Products Specs comparison table.
|
|
3
|
+
|
|
4
|
+
Two block types:
|
|
5
|
+
- "product": a column header (product select + image + description).
|
|
6
|
+
- "specs": a row of spec values, one value per product.
|
|
7
|
+
|
|
8
|
+
Product columns render in block order. For each spec row, the value shown
|
|
9
|
+
under a product is chosen from the spec block's fields according to that
|
|
10
|
+
product's selected type (X1 / X1 PRO / X1 PROMAX / AQUA).
|
|
11
|
+
{%- endcomment -%}
|
|
12
|
+
|
|
13
|
+
{%- assign product_blocks = section.blocks | where: 'type', 'product' -%}
|
|
14
|
+
{%- assign spec_blocks = section.blocks | where: 'type', 'specs' -%}
|
|
15
|
+
{%- assign product_block_count = product_blocks.size | at_least: 1 -%}
|
|
16
|
+
{%- assign uid = section.id -%}
|
|
17
|
+
|
|
18
|
+
<div
|
|
19
|
+
id="ProductsSpecs-{{ uid }}" class="tw-box-border"
|
|
20
|
+
data-zz-module-name="compare-id"
|
|
21
|
+
>
|
|
22
|
+
<div class="tw-box-border tw-mx-auto tw-max-w-[1220px] lg:tw-py-[80px] max-lg:tw-pt-[48px] max-lg:tw-pb-[30px]">
|
|
23
|
+
{%- if section.settings.title != blank -%}
|
|
24
|
+
<div class="tw-mb-[3rem] lg:tw-mb-[100px] tw-text-center tw-font-bold tw-text-[#2d2d2d] tw-leading-[1] tw-text-[2.8rem] lg:tw-text-[40px]">
|
|
25
|
+
{{ section.settings.title | escape }}
|
|
26
|
+
</div>
|
|
27
|
+
{%- endif -%}
|
|
28
|
+
|
|
29
|
+
<div class="max-lg:tw-overflow-x-auto tw-px-[20px] lg:tw-px-[40px] tw-py-[30px] lg:tw-py-[60px] tw-rounded-[10px] lg:tw-rounded-[16px] tw-bg-[#fafafa] [-webkit-overflow-scrolling:touch]" data-specs-scroll>
|
|
30
|
+
<div class="products-specs-content" data-specs-content>
|
|
31
|
+
{%- comment -%} Header: empty first cell + one column per product {%- endcomment -%}
|
|
32
|
+
<div class="tw-flex tw-items-stretch lg:tw-pb-[40px] max-lg:tw-pb-[30px]" data-specs-header>
|
|
33
|
+
<div class="lg:tw-w-[220px] tw-shrink-0 max-lg:tw-hidden"> </div>
|
|
34
|
+
<div class="tw-flex tw-gap-[20px] lg:tw-gap-[30px] tw-flex-1" data-specs-header-row>
|
|
35
|
+
{%- for product in product_blocks -%}
|
|
36
|
+
<div
|
|
37
|
+
class="value-item tw-box-border tw-flex tw-flex-col tw-items-start tw-gap-[10px] lg:tw-gap-[12px]"
|
|
38
|
+
data-specs-product-col
|
|
39
|
+
data-specs-heading="{{ product.settings.heading | escape }}"
|
|
40
|
+
{{ product.shopify_attributes }}
|
|
41
|
+
>
|
|
42
|
+
{% assign product_all = all_products[product.settings.product] %}
|
|
43
|
+
{% assign variant_id = product.settings.variant_id | times: 1 %}
|
|
44
|
+
{% assign variant = product_all.variants | where: 'id', variant_id | first %}
|
|
45
|
+
{%- if product.settings.image != blank -%}
|
|
46
|
+
{{
|
|
47
|
+
product.settings.image
|
|
48
|
+
| image_url: width: 400
|
|
49
|
+
| image_tag:
|
|
50
|
+
class: 'product-image tw-w-[128px] lg:tw-w-[168px] tw-object-contain tw-object-center tw-aspect-[168/132]',
|
|
51
|
+
loading: 'lazy',
|
|
52
|
+
alt: product.settings.heading
|
|
53
|
+
}}
|
|
54
|
+
{%- endif -%}
|
|
55
|
+
<div class="tw-break-words tw-font-bold tw-leading-[1.5] tw-mt-[10px] lg:tw-mt-[18px] tw-text-[#2d2d2d] lg:tw-text-[28px] max-lg:tw-text-[1.8rem]">{{ product.settings.heading | escape }}</div>
|
|
56
|
+
|
|
57
|
+
{%- if product.settings.description != blank -%}
|
|
58
|
+
<div class="tw-break-words tw-text-[1.2rem] lg:tw-text-[14px] tw-font-bold tw-leading-[1.5] tw-text-[#2d2d2d]">{{ product.settings.description | escape | newline_to_br }}</div>
|
|
59
|
+
{%- endif -%}
|
|
60
|
+
<div class="tw-align-middle tw-text-center tw-text-[1.4rem] lg:tw-text-[20px] tw-leading-[1.5] tw-tracking-[0px] tw-text-[#2D2D2DCC]">{{ section.settings.price_prefix }} {{ variant.price | money_without_trailing_zeros }}</div>
|
|
61
|
+
</div>
|
|
62
|
+
{%- endfor -%}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
{%- comment -%} Spec rows: name cell + value per product (ordered by header) {%- endcomment -%}
|
|
67
|
+
{%- for spec in spec_blocks -%}
|
|
68
|
+
<div class="tw-flex tw-items-stretch tw-border-b max-lg:tw-w-fit tw-border-solid tw-border-[rgba(45,45,45,0.1)] tw-py-[15px] lg:tw-py-[30px] max-lg:tw-flex-col max-lg:tw-items-start" {{ spec.shopify_attributes }}>
|
|
69
|
+
<div class="tw-break-words tw-font-bold tw-leading-[1.5] tw-text-[#2d2d2d] lg:tw-w-[220px] lg:tw-text-[16px] max-lg:tw-w-[14rem] max-lg:tw-mb-[10px] max-lg:tw-shrink-0 max-lg:tw-text-[12px]">{{ spec.settings.heading | escape | newline_to_br }}</div>
|
|
70
|
+
<div class="tw-flex tw-flex-1 tw-items-center tw-gap-[20px] lg:tw-gap-[30px]">
|
|
71
|
+
{%- for product in product_blocks -%}
|
|
72
|
+
{%- case product.settings.heading -%}
|
|
73
|
+
{%- when 'X1' -%}
|
|
74
|
+
{%- assign cell_value = spec.settings.x1_value -%}
|
|
75
|
+
{%- when 'X1 PRO' -%}
|
|
76
|
+
{%- assign cell_value = spec.settings.x1_pro_value -%}
|
|
77
|
+
{%- when 'X1 PROMAX' -%}
|
|
78
|
+
{%- assign cell_value = spec.settings.x1_promax_value -%}
|
|
79
|
+
{%- when 'AQUA' -%}
|
|
80
|
+
{%- assign cell_value = spec.settings.aqua_value -%}
|
|
81
|
+
{%- else -%}
|
|
82
|
+
{%- assign cell_value = '' -%}
|
|
83
|
+
{%- endcase -%}
|
|
84
|
+
<div class="value-item tw-break-words tw-text-[10px] lg:tw-text-[16px] tw-leading-[1.5] tw-text-[rgba(45,45,45,0.8)]"
|
|
85
|
+
>{{ cell_value | escape | newline_to_br }}</div>
|
|
86
|
+
{%- endfor -%}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
{%- endfor -%}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div class="specs-floating-head" data-specs-float aria-hidden="true">
|
|
95
|
+
<div class="specs-floating-head__inner" data-specs-float-inner>
|
|
96
|
+
<div class="specs-floating-head__spacer max-lg:tw-hidden" data-specs-float-spacer> </div>
|
|
97
|
+
<div class="specs-floating-head__row" data-specs-float-row>
|
|
98
|
+
{%- for product in product_blocks -%}
|
|
99
|
+
<div class="specs-floating-head__cell value-item tw-font-bold tw-leading-[1.5] tw-mt-[10px] lg:tw-mt-[18px] tw-text-[#2d2d2d] lg:tw-text-[28px] max-lg:tw-text-[1.8rem]" data-specs-float-cell>{{ product.settings.heading | escape }}</div>
|
|
100
|
+
{%- endfor -%}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<style>
|
|
107
|
+
@media screen and (max-width: 1023px) {
|
|
108
|
+
#shopify-section-{{section.id}} .value-item {
|
|
109
|
+
width: 14.5rem;
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
@media screen and (min-width: 1023px) {
|
|
114
|
+
#shopify-section-{{section.id}} .value-item {
|
|
115
|
+
flex-basis: calc(100% / {{ product_block_count }});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
{%- comment -%} Floating heading row: fixed to viewport, hidden by default {%- endcomment -%}
|
|
120
|
+
#shopify-section-{{ section.id }} .specs-floating-head {
|
|
121
|
+
position: fixed;
|
|
122
|
+
top: 0;
|
|
123
|
+
left: 0;
|
|
124
|
+
z-index: 30;
|
|
125
|
+
display: none;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
background: #fafafa;
|
|
128
|
+
box-shadow: 0 4px 12px rgba(45, 45, 45, 0.06);
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
#shopify-section-{{ section.id }} .specs-floating-head.is-visible {
|
|
132
|
+
display: block;
|
|
133
|
+
}
|
|
134
|
+
#shopify-section-{{ section.id }} .specs-floating-head__inner {
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: stretch;
|
|
137
|
+
padding-top: 15px;
|
|
138
|
+
padding-bottom: 15px;
|
|
139
|
+
will-change: transform;
|
|
140
|
+
}
|
|
141
|
+
#shopify-section-{{ section.id }} .specs-floating-head__spacer {
|
|
142
|
+
flex-shrink: 0;
|
|
143
|
+
}
|
|
144
|
+
#shopify-section-{{ section.id }} .specs-floating-head__row {
|
|
145
|
+
display: flex;
|
|
146
|
+
flex: 1 1 auto;
|
|
147
|
+
gap: 20px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@media screen and (min-width: 1024px) {
|
|
151
|
+
#shopify-section-{{ section.id }} .specs-floating-head__inner {
|
|
152
|
+
padding-top: 18px;
|
|
153
|
+
padding-bottom: 18px;
|
|
154
|
+
}
|
|
155
|
+
#shopify-section-{{ section.id }} .specs-floating-head__row {
|
|
156
|
+
gap: 30px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
</style>
|
|
161
|
+
|
|
162
|
+
<script>
|
|
163
|
+
(function () {
|
|
164
|
+
var root = document.getElementById('ProductsSpecs-{{ uid }}');
|
|
165
|
+
if (!root || root.dataset.specsFloatBound === 'true') { return; }
|
|
166
|
+
root.dataset.specsFloatBound = 'true';
|
|
167
|
+
|
|
168
|
+
var scroller = root.querySelector('[data-specs-scroll]');
|
|
169
|
+
var content = root.querySelector('[data-specs-content]');
|
|
170
|
+
var header = root.querySelector('[data-specs-header]');
|
|
171
|
+
var headerRow = root.querySelector('[data-specs-header-row]');
|
|
172
|
+
var floatEl = root.querySelector('[data-specs-float]');
|
|
173
|
+
var floatInner = root.querySelector('[data-specs-float-inner]');
|
|
174
|
+
var floatSpacer = root.querySelector('[data-specs-float-spacer]');
|
|
175
|
+
var floatRow = root.querySelector('[data-specs-float-row]');
|
|
176
|
+
var srcCols = Array.prototype.slice.call(root.querySelectorAll('[data-specs-product-col]'));
|
|
177
|
+
var floatCells = Array.prototype.slice.call(root.querySelectorAll('[data-specs-float-cell]'));
|
|
178
|
+
|
|
179
|
+
if (!scroller || !content || !header || !headerRow || !floatEl) { return; }
|
|
180
|
+
|
|
181
|
+
var isVisible = false;
|
|
182
|
+
var ticking = false;
|
|
183
|
+
|
|
184
|
+
{%- comment -%} Height of the visible content-nagivation bar (mobile vs pc) {%- endcomment -%}
|
|
185
|
+
function getNavHeight() {
|
|
186
|
+
var pc = document.querySelector('.content-nagivation-pc');
|
|
187
|
+
var mobile = document.querySelector('.content-nagivation-mobile');
|
|
188
|
+
{%- comment -%} the hidden one (wrong breakpoint) reports offsetHeight 0 {%- endcomment -%}
|
|
189
|
+
var pcH = pc ? pc.offsetHeight : 0;
|
|
190
|
+
var mobileH = mobile ? mobile.offsetHeight : 0;
|
|
191
|
+
return Math.max(pcH, mobileH, 0);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
{%- comment -%} Match float bar geometry to the scroller (width, left, padding, column sizing) {%- endcomment -%}
|
|
195
|
+
function syncLayout() {
|
|
196
|
+
var scRect = scroller.getBoundingClientRect();
|
|
197
|
+
var cs = window.getComputedStyle(scroller);
|
|
198
|
+
var padLeft = parseFloat(cs.paddingLeft) || 0;
|
|
199
|
+
var padRight = parseFloat(cs.paddingRight) || 0;
|
|
200
|
+
|
|
201
|
+
floatEl.style.left = scRect.left + 'px';
|
|
202
|
+
floatEl.style.top = getNavHeight() + 'px';
|
|
203
|
+
floatEl.style.width = scRect.width + 'px';
|
|
204
|
+
floatInner.style.paddingLeft = padLeft + 'px';
|
|
205
|
+
floatInner.style.paddingRight = padRight + 'px';
|
|
206
|
+
|
|
207
|
+
{%- comment -%} spacer = first empty label cell width (desktop only; hidden on mobile) {%- endcomment -%}
|
|
208
|
+
var firstEmpty = header.firstElementChild;
|
|
209
|
+
if (firstEmpty && floatSpacer) {
|
|
210
|
+
floatSpacer.style.width = firstEmpty.getBoundingClientRect().width + 'px';
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
{%- comment -%} match each float cell width to its source column {%- endcomment -%}
|
|
214
|
+
for (var i = 0; i < floatCells.length; i++) {
|
|
215
|
+
var src = srcCols[i];
|
|
216
|
+
if (!src) { continue; }
|
|
217
|
+
var w = src.getBoundingClientRect().width;
|
|
218
|
+
floatCells[i].style.flex = '0 0 ' + w + 'px';
|
|
219
|
+
floatCells[i].style.width = w + 'px';
|
|
220
|
+
}
|
|
221
|
+
{%- comment -%} match the header row gap so cells align 1:1 {%- endcomment -%}
|
|
222
|
+
var rowCs = window.getComputedStyle(headerRow);
|
|
223
|
+
floatRow.style.gap = rowCs.columnGap || rowCs.gap || '20px';
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
{%- comment -%} A方案核心: follow horizontal scroll of the table {%- endcomment -%}
|
|
227
|
+
function syncScrollX() {
|
|
228
|
+
floatInner.style.transform = 'translateX(' + (-scroller.scrollLeft) + 'px)';
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function update() {
|
|
232
|
+
ticking = false;
|
|
233
|
+
var navH = getNavHeight();
|
|
234
|
+
var headRect = header.getBoundingClientRect();
|
|
235
|
+
var contentRect = content.getBoundingClientRect();
|
|
236
|
+
var floatH = floatEl.offsetHeight || headRect.height;
|
|
237
|
+
|
|
238
|
+
{%- comment -%} show once product row scrolls under the nav, hide when content bottom passes {%- endcomment -%}
|
|
239
|
+
var shouldShow = headRect.bottom <= navH && contentRect.bottom > navH + floatH;
|
|
240
|
+
|
|
241
|
+
if (shouldShow && !isVisible) {
|
|
242
|
+
isVisible = true;
|
|
243
|
+
syncLayout();
|
|
244
|
+
syncScrollX();
|
|
245
|
+
floatEl.classList.add('is-visible');
|
|
246
|
+
floatEl.setAttribute('aria-hidden', 'false');
|
|
247
|
+
} else if (!shouldShow && isVisible) {
|
|
248
|
+
isVisible = false;
|
|
249
|
+
floatEl.classList.remove('is-visible');
|
|
250
|
+
floatEl.setAttribute('aria-hidden', 'true');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function onScroll() {
|
|
255
|
+
if (!ticking) {
|
|
256
|
+
ticking = true;
|
|
257
|
+
window.requestAnimationFrame(update);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
window.addEventListener('scroll', onScroll, { passive: true });
|
|
262
|
+
window.addEventListener('resize', function () {
|
|
263
|
+
if (isVisible) { syncLayout(); syncScrollX(); }
|
|
264
|
+
onScroll();
|
|
265
|
+
}, { passive: true });
|
|
266
|
+
scroller.addEventListener('scroll', function () {
|
|
267
|
+
if (isVisible) { syncScrollX(); }
|
|
268
|
+
}, { passive: true });
|
|
269
|
+
|
|
270
|
+
{%- comment -%} initial run (defer to allow images/layout to settle) {%- endcomment -%}
|
|
271
|
+
if (document.readyState === 'complete') {
|
|
272
|
+
update();
|
|
273
|
+
} else {
|
|
274
|
+
window.addEventListener('load', update, { once: true });
|
|
275
|
+
}
|
|
276
|
+
update();
|
|
277
|
+
})();
|
|
278
|
+
</script>
|
|
279
|
+
|
|
280
|
+
{% schema %}
|
|
281
|
+
{
|
|
282
|
+
"name": "ZZ Products Specs",
|
|
283
|
+
"tag": "section",
|
|
284
|
+
"class": "products-specs-section",
|
|
285
|
+
"settings": [
|
|
286
|
+
{
|
|
287
|
+
"type": "text",
|
|
288
|
+
"id": "title",
|
|
289
|
+
"label": "Section title",
|
|
290
|
+
"default": "Specs"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"type": "text",
|
|
294
|
+
"id": "price_prefix",
|
|
295
|
+
"label": "Price prefix",
|
|
296
|
+
"default": "from"
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"blocks": [
|
|
300
|
+
{
|
|
301
|
+
"type": "product",
|
|
302
|
+
"name": "Product",
|
|
303
|
+
"settings": [
|
|
304
|
+
{
|
|
305
|
+
"type": "select",
|
|
306
|
+
"id": "heading",
|
|
307
|
+
"label": "Product",
|
|
308
|
+
"options": [
|
|
309
|
+
{ "value": "X1", "label": "X1" },
|
|
310
|
+
{ "value": "X1 PRO", "label": "X1 PRO" },
|
|
311
|
+
{ "value": "X1 PROMAX", "label": "X1 PROMAX" },
|
|
312
|
+
{ "value": "AQUA", "label": "AQUA" }
|
|
313
|
+
],
|
|
314
|
+
"default": "X1"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"type": "product",
|
|
318
|
+
"id": "product",
|
|
319
|
+
"label": "Product",
|
|
320
|
+
"info": "选择产品,获取价格"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"type": "text",
|
|
324
|
+
"id": "variant_id",
|
|
325
|
+
"label": "Variant ID",
|
|
326
|
+
"placeholder": "变体ID",
|
|
327
|
+
"info": "输入变体ID,变体ID可以在产品编辑页面查看,获取价格"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"type": "image_picker",
|
|
331
|
+
"id": "image",
|
|
332
|
+
"label": "Product image"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"type": "textarea",
|
|
336
|
+
"id": "description",
|
|
337
|
+
"label": "Description"
|
|
338
|
+
}
|
|
339
|
+
]
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"type": "specs",
|
|
343
|
+
"name": "Spec",
|
|
344
|
+
"settings": [
|
|
345
|
+
{
|
|
346
|
+
"type": "textarea",
|
|
347
|
+
"id": "heading",
|
|
348
|
+
"label": "Spec name"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"type": "textarea",
|
|
352
|
+
"id": "x1_value",
|
|
353
|
+
"label": "X1 value"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"type": "textarea",
|
|
357
|
+
"id": "x1_pro_value",
|
|
358
|
+
"label": "X1 PRO value"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"type": "textarea",
|
|
362
|
+
"id": "x1_promax_value",
|
|
363
|
+
"label": "X1 PROMAX value"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"type": "textarea",
|
|
367
|
+
"id": "aqua_value",
|
|
368
|
+
"label": "AQUA value"
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
],
|
|
373
|
+
"presets": [
|
|
374
|
+
{
|
|
375
|
+
"name": "ZZ Products Specs",
|
|
376
|
+
"blocks": [
|
|
377
|
+
{ "type": "product" },
|
|
378
|
+
{ "type": "product" },
|
|
379
|
+
{ "type": "product" },
|
|
380
|
+
{ "type": "product" },
|
|
381
|
+
{ "type": "specs" },
|
|
382
|
+
{ "type": "specs" },
|
|
383
|
+
{ "type": "specs" }
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
{% endschema %}
|
|
@@ -981,7 +981,7 @@
|
|
|
981
981
|
</div>
|
|
982
982
|
<div
|
|
983
983
|
class='banner-title lg:tw-hidden tw-p-0 {% if banner.settings.banner_type == 'title_description_type' %} tw-font-bold {% endif %} max-lg:tw-leading-[1.2] max-lg:tw-text-center'
|
|
984
|
-
|
|
984
|
+
style='color: {{ banner.settings.color | default: 'white' }};'
|
|
985
985
|
>
|
|
986
986
|
{{ banner.settings.title_mb }}
|
|
987
987
|
</div>
|