zz-shopify-components 0.29.1-beta.2 → 0.29.1-beta.3
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/package.json
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
"label": "背景颜色",
|
|
10
10
|
"default": "#000000"
|
|
11
11
|
},
|
|
12
|
+
{
|
|
13
|
+
"type": "number",
|
|
14
|
+
"id": "show_after_scroll_vh",
|
|
15
|
+
"label": "下滑多少视口高度(vh)后出现",
|
|
16
|
+
"default": 0,
|
|
17
|
+
"info": "默认为0,表示一直显示。例如设置为 100,则滑动超过 100vh 后导航栏才会滑出显示。"
|
|
18
|
+
},
|
|
12
19
|
{
|
|
13
20
|
"type": "image_picker",
|
|
14
21
|
"id": "icon",
|
|
@@ -179,6 +186,25 @@
|
|
|
179
186
|
<script>
|
|
180
187
|
document.addEventListener('DOMContentLoaded', (event) => {
|
|
181
188
|
const isDesktop = window.innerWidth > 1024;
|
|
189
|
+
const currentSection = document.getElementById('shopify-section-{{section.id}}');
|
|
190
|
+
|
|
191
|
+
// 滚动显示逻辑
|
|
192
|
+
const showAfterVh = {{ section.settings.show_after_scroll_vh | default: 0 }};
|
|
193
|
+
if (showAfterVh > 0) {
|
|
194
|
+
const threshold = window.innerHeight * (showAfterVh / 100);
|
|
195
|
+
|
|
196
|
+
const handleScroll = () => {
|
|
197
|
+
if (window.scrollY > threshold) {
|
|
198
|
+
currentSection.classList.add('is-visible');
|
|
199
|
+
} else {
|
|
200
|
+
currentSection.classList.remove('is-visible');
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
window.addEventListener('scroll', handleScroll, { passive: true });
|
|
205
|
+
// 初始化检查一次
|
|
206
|
+
handleScroll();
|
|
207
|
+
}
|
|
182
208
|
|
|
183
209
|
function scrollPaginationToCenter() {
|
|
184
210
|
// 获取当前section
|
|
@@ -203,9 +229,6 @@
|
|
|
203
229
|
}
|
|
204
230
|
}
|
|
205
231
|
|
|
206
|
-
const currentSection = document.getElementById(
|
|
207
|
-
'shopify-section-{{section.id}}'
|
|
208
|
-
);
|
|
209
232
|
// 获取通知栏以及顶部弹窗 调整sticky的top。id="IPTipsBox",id="zz-quick-announcement-bar-container"
|
|
210
233
|
const iptipsBox = document.getElementById('IPTipsBox');
|
|
211
234
|
const pcDropdowns = document.querySelectorAll('.menu-wrapper');
|
|
@@ -345,7 +368,25 @@
|
|
|
345
368
|
position: sticky;
|
|
346
369
|
width: 100%;
|
|
347
370
|
background-color: {{ section.settings.background_color }};
|
|
371
|
+
{% if section.settings.show_after_scroll_vh > 0 %}
|
|
372
|
+
transform: translateY(-200%);
|
|
373
|
+
transition: transform 0.3s ease-in-out, height 0s linear 0.3s; /* 延迟高度变化,等动画做完 */
|
|
374
|
+
pointer-events: none;
|
|
375
|
+
z-index: -1 !important;
|
|
376
|
+
height: 0 !important; /* 关键:隐藏时不占位 */
|
|
377
|
+
overflow: hidden;
|
|
378
|
+
{% endif %}
|
|
348
379
|
}
|
|
380
|
+
{% if section.settings.show_after_scroll_vh > 0 %}
|
|
381
|
+
#shopify-section-{{ section.id }}.is-visible {
|
|
382
|
+
transform: translateY(0);
|
|
383
|
+
pointer-events: auto;
|
|
384
|
+
z-index: 501 !important;
|
|
385
|
+
height: auto !important; /* 恢复高度 */
|
|
386
|
+
overflow: visible;
|
|
387
|
+
transition: transform 0.3s ease-in-out; /* 恢复时高度立即变回来,然后做位移 */
|
|
388
|
+
}
|
|
389
|
+
{% endif %}
|
|
349
390
|
body {
|
|
350
391
|
overflow-x: hidden;
|
|
351
392
|
}
|
|
@@ -35,18 +35,32 @@ size:按钮尺寸
|
|
|
35
35
|
%}
|
|
36
36
|
|
|
37
37
|
<div
|
|
38
|
-
class='togglePopup
|
|
38
|
+
class='togglePopup popup tw-flex !tw-hidden tw-bg-[rgba(0,0,0,0.9)] tw-items-center tw-justify-center tw-fixed tw-top-0 tw-left-0 tw-right-0 tw-bottom-0 tw-z-[999] tw-overflow-hidden'
|
|
39
39
|
>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
|
|
41
|
+
<div class="tw-relative tw-w-full tw-h-full tw-flex tw-justify-center tw-items-center">
|
|
42
|
+
<svg
|
|
43
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
+
aria-hidden="true"
|
|
45
|
+
focusable="false"
|
|
46
|
+
fill="none"
|
|
47
|
+
viewBox="0 0 18 17"
|
|
48
|
+
class="icon icon-close tw-cursor-pointer tw-absolute lg:tw-h-[20px] tw-h-[16px] tw-top-[5%] tw-right-[5%] togglePopup"
|
|
49
|
+
>
|
|
50
|
+
<path d="M.865 15.978a.5.5 0 00.707.707l7.433-7.431 7.579 7.282a.501.501 0 00.846-.37.5.5 0 00-.153-.351L9.712 8.546l7.417-7.416a.5.5 0 10-.707-.708L8.991 7.853 1.413.573a.5.5 0 10-.693.72l7.563 7.268-7.418 7.417z" fill="white">
|
|
51
|
+
</svg>
|
|
52
|
+
|
|
53
|
+
<div class="tw-max-w-[960px]">
|
|
54
|
+
{% render 'zz-video',
|
|
55
|
+
pc_video: video,
|
|
56
|
+
pc_poster: poster,
|
|
57
|
+
lazy: false,
|
|
58
|
+
class: ' tw-w-full tw-h-auto',
|
|
59
|
+
autoplay: false,
|
|
60
|
+
loop: true,
|
|
61
|
+
%}
|
|
62
|
+
|
|
63
|
+
</div>
|
|
50
64
|
</div>
|
|
51
65
|
|
|
52
66
|
</div>
|