zz-shopify-components 0.34.1-beta.9 → 0.35.1-beta.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.
Files changed (32) hide show
  1. package/assets/zz-components.js +129 -53
  2. package/blocks/zz-card-animate-text.liquid +7 -1
  3. package/blocks/zz-normal-swiper.liquid +22 -0
  4. package/blocks/zz-product-switch-card.liquid +4 -1
  5. package/blocks/zz-ratio-video.liquid +7 -1
  6. package/blocks/zz-responsive-width-video.liquid +7 -1
  7. package/blocks/zz-scrollTrigger-block.liquid +247 -0
  8. package/blocks/zz-swiper-title-in-item.liquid +9 -1
  9. package/blocks/zz-video-button.liquid +1 -1
  10. package/blocks/zz-video-img-scale-item.liquid +237 -0
  11. package/blocks/zz-video-img-swiper.liquid +302 -0
  12. package/blocks/zz-video-preview-btn.liquid +1 -1
  13. package/blocks/zz-video-swiper-perview-item.liquid +10 -3
  14. package/blocks/zz-video-swiper-perview-jp.liquid +3 -0
  15. package/blocks/zz-world-video.liquid +2 -2
  16. package/package.json +1 -1
  17. package/sections/zz-expand-video-swiper.liquid +9 -1
  18. package/sections/zz-live-chat.liquid +764 -118
  19. package/sections/zz-navigation-tab-v3.liquid +3 -2
  20. package/sections/zz-swiper-banner.liquid +128 -67
  21. package/sections/zz-swiper-gallery-center.liquid +9 -2
  22. package/sections/zz-swiper-gallery.liquid +13 -5
  23. package/sections/zz-video-collapse-swiper.liquid +10 -2
  24. package/sections/zz-video-progress-swiper.liquid +9 -2
  25. package/sections/zz-video-tab-swiper.liquid +9 -2
  26. package/sections/zz-voc-section.liquid +199 -50
  27. package/snippets/zz-button-v2.liquid +24 -10
  28. package/snippets/zz-buy-buttom.liquid +1 -1
  29. package/snippets/zz-video-button.liquid +1 -0
  30. package/snippets/zz-video-md.liquid +8 -0
  31. package/snippets/zz-video-popup.liquid +1 -1
  32. package/snippets/zz-video.liquid +2 -0
@@ -173,7 +173,6 @@ if (!customElements.get('zz-video-popup')) {
173
173
  this.popup = null;
174
174
  }
175
175
 
176
-
177
176
  connectedCallback() {
178
177
  this.querySelectorAll('.togglePopup').forEach((el) => {
179
178
  el.addEventListener('click', (event) => {
@@ -184,8 +183,6 @@ if (!customElements.get('zz-video-popup')) {
184
183
  });
185
184
  });
186
185
  this.popup = this.querySelector('.popup');
187
-
188
-
189
186
  }
190
187
 
191
188
  disconnectedCallback() {
@@ -226,7 +223,7 @@ if (!customElements.get('zz-video-popup')) {
226
223
  backdropFilter: 'blur(30px)',
227
224
  onComplete: () => {
228
225
  const videos = this.popup.querySelectorAll('video');
229
- videos.forEach(video => {
226
+ videos.forEach((video) => {
230
227
  if (window.getComputedStyle(video).display !== 'none') {
231
228
  video.play();
232
229
  }
@@ -246,7 +243,7 @@ if (!customElements.get('zz-video-popup')) {
246
243
  onComplete: () => {
247
244
  this.popup.classList.add('!tw-hidden');
248
245
  const videos = this.popup.querySelectorAll('video');
249
- videos.forEach(video => {
246
+ videos.forEach((video) => {
250
247
  if (video) {
251
248
  video.pause();
252
249
  }
@@ -261,7 +258,6 @@ if (!customElements.get('zz-video-popup')) {
261
258
  customElements.define('zz-video-popup', ZZVideoPopup);
262
259
  }
263
260
 
264
-
265
261
  if (!customElements.get('zz-video-handler')) {
266
262
  class ZZVideoHandler extends HTMLElement {
267
263
  constructor() {
@@ -310,7 +306,6 @@ if (!customElements.get('zz-video-handler')) {
310
306
  customElements.define('zz-video-handler', ZZVideoHandler);
311
307
  }
312
308
 
313
-
314
309
  /**
315
310
  * Toast 组件
316
311
  */
@@ -430,9 +425,11 @@ if (!customElements.get('zz-video-handler')) {
430
425
  function isSafari() {
431
426
  const ua = navigator.userAgent;
432
427
  // 包含 Safari / WebKit,且不包含 Chrome / CriOS / FxiOS / Android
433
- return /Safari/.test(ua)
434
- && /AppleWebKit/.test(ua)
435
- && !/CriOS|FxiOS|Chrome|Edg|OPR/.test(ua);
428
+ return (
429
+ /Safari/.test(ua) &&
430
+ /AppleWebKit/.test(ua) &&
431
+ !/CriOS|FxiOS|Chrome|Edg|OPR/.test(ua)
432
+ );
436
433
  }
437
434
 
438
435
  function isSafari26() {
@@ -442,8 +439,6 @@ if (!customElements.get('zz-video-handler')) {
442
439
  return /Version\/26\./.test(ua);
443
440
  }
444
441
 
445
-
446
-
447
442
  function lockBodyScroll() {
448
443
  if (isSafari26()) {
449
444
  scrollTop = window.scrollY;
@@ -506,11 +501,10 @@ document.addEventListener('DOMContentLoaded', (event) => {
506
501
  entries.forEach((entry) => {
507
502
  const el = entry.target;
508
503
  if (entry.isIntersecting) {
509
-
510
504
  } else {
511
505
  if (el.classList.contains('zz-card-animate-list')) {
512
506
  // 重置所有
513
- el.querySelectorAll('.zz-card-inner').forEach(card => {
507
+ el.querySelectorAll('.zz-card-inner').forEach((card) => {
514
508
  card.classList.remove('is-active');
515
509
  });
516
510
  }
@@ -518,47 +512,48 @@ document.addEventListener('DOMContentLoaded', (event) => {
518
512
  });
519
513
  });
520
514
 
521
-
522
515
  if (!isDesktop) {
523
516
  const switchCard = document.querySelectorAll('.product-switch-card');
524
517
  // 监听所有的switchCard 当它完全出现屏幕中时候,定时2秒切换成背景图。移出屏幕时候恢复
525
518
 
526
519
  if (switchCard.length > 0) {
527
520
  const switchTimers = new Map(); // 存储每个卡片的定时器
528
-
529
- const switchCardObserver = new IntersectionObserver((entries) => {
530
- entries.forEach((entry) => {
531
- const card = entry.target;
532
- console.log('switchCardObserver')
533
- if (entry.isIntersecting && entry.intersectionRatio >= 0.8) {
534
- // 完全出现在屏幕中,2秒后切换成背景图
535
- const timer = setInterval(() => {
536
- if (card.classList.contains('switchCard')) {
537
- card.classList.remove('switchCard');
538
- } else {
539
- card.classList.add('switchCard');
521
+
522
+ const switchCardObserver = new IntersectionObserver(
523
+ (entries) => {
524
+ entries.forEach((entry) => {
525
+ const card = entry.target;
526
+ console.log('switchCardObserver');
527
+ if (entry.isIntersecting && entry.intersectionRatio >= 0.8) {
528
+ // 完全出现在屏幕中,2秒后切换成背景图
529
+ const timer = setInterval(() => {
530
+ if (card.classList.contains('switchCard')) {
531
+ card.classList.remove('switchCard');
532
+ } else {
533
+ card.classList.add('switchCard');
534
+ }
535
+ }, 2000);
536
+ switchTimers.set(card, timer);
537
+ } else {
538
+ // 移出屏幕,恢复原状
539
+ const timer = switchTimers.get(card);
540
+ if (timer) {
541
+ clearInterval(timer);
542
+ switchTimers.delete(card);
540
543
  }
541
- }, 2000);
542
- switchTimers.set(card, timer);
543
- } else {
544
- // 移出屏幕,恢复原状
545
- const timer = switchTimers.get(card);
546
- if (timer) {
547
- clearInterval(timer);
548
- switchTimers.delete(card);
544
+ card.classList.remove('switchCard');
549
545
  }
550
- card.classList.remove('switchCard');
551
- }
552
- });
553
- }, {
554
- threshold: [0.2, 0.8] // 监听0%、99%和100%的可见度
555
- });
556
-
557
- switchCard.forEach(card => {
546
+ });
547
+ },
548
+ {
549
+ threshold: [0.2, 0.8], // 监听0%、99%和100%的可见度
550
+ }
551
+ );
552
+
553
+ switchCard.forEach((card) => {
558
554
  switchCardObserver.observe(card);
559
555
  });
560
556
  }
561
-
562
557
  }
563
558
 
564
559
  // 处理统一的定位脚本
@@ -568,17 +563,17 @@ document.addEventListener('DOMContentLoaded', (event) => {
568
563
  if (positionTrigger) {
569
564
  const selector = positionTrigger.getAttribute('data-zz-module-target');
570
565
  if (selector) {
571
- const target = document.querySelector(`[data-zz-module-name="${selector}"]`);
572
- const headerHeight = 50;
573
- const offsetTop = target.offsetTop - headerHeight;
574
- window.scrollTo(0, offsetTop);
575
-
566
+ const target = document.querySelector(
567
+ `[data-zz-module-name="${selector}"]`
568
+ );
569
+ const headerHeight = 50;
570
+ const offsetTop = target.offsetTop - headerHeight;
571
+ window.scrollTo(0, offsetTop);
576
572
  }
577
573
  return;
578
574
  }
579
575
  });
580
576
 
581
-
582
577
  // zz-card-animate-text.liquid
583
578
  const cardListGroup = document.querySelectorAll('.zz-card-animate-list');
584
579
  cardListGroup.forEach((list) => {
@@ -591,7 +586,7 @@ document.addEventListener('DOMContentLoaded', (event) => {
591
586
  console.log('click card item');
592
587
 
593
588
  // 重置所有
594
- list.querySelectorAll('.zz-card-inner').forEach(el => {
589
+ list.querySelectorAll('.zz-card-inner').forEach((el) => {
595
590
  el.classList.remove('is-active');
596
591
  });
597
592
 
@@ -599,8 +594,89 @@ document.addEventListener('DOMContentLoaded', (event) => {
599
594
  item.classList.add('is-active');
600
595
  });
601
596
  compIntersectionObserver.observe(list);
602
-
603
597
  });
598
+ });
599
+
600
+ if (!customElements.get('zz-normal-modal')) {
601
+ class ZZNormalModal extends HTMLElement {
602
+ constructor() {
603
+ super();
604
+ this.handleOverlayClick = this.handleOverlayClick.bind(this);
605
+ this.handleDocumentKeydown = this.handleDocumentKeydown.bind(this);
606
+ this.handleCloseClick = this.handleCloseClick.bind(this);
607
+ }
608
+
609
+ connectedCallback() {
610
+ this.dialogContent = this.querySelector('[data-modal-content]');
611
+ this.overlay = this.querySelector('[data-modal-overlay]');
612
+ this.closeButton = this.querySelector('[data-modal-close]');
604
613
 
614
+ if (this.overlay) {
615
+ this.overlay.addEventListener('click', this.handleOverlayClick);
616
+ }
617
+
618
+ if (this.closeButton) {
619
+ this.closeButton.addEventListener('click', this.handleCloseClick);
620
+ }
621
+ }
605
622
 
606
- });
623
+ disconnectedCallback() {
624
+ if (this.overlay) {
625
+ this.overlay.removeEventListener('click', this.handleOverlayClick);
626
+ }
627
+
628
+ if (this.closeButton) {
629
+ this.closeButton.removeEventListener('click', this.handleCloseClick);
630
+ }
631
+
632
+ document.removeEventListener('keydown', this.handleDocumentKeydown);
633
+ }
634
+
635
+ show() {
636
+ this.previousActiveElement = document.activeElement;
637
+ this.dialogContent.classList.add('is-open');
638
+ this.overlay.classList.add('is-open');
639
+ this.setAttribute('aria-hidden', 'false');
640
+ window.zzLockBodyScroll && window.zzLockBodyScroll();
641
+ document.addEventListener('keydown', this.handleDocumentKeydown);
642
+
643
+ requestAnimationFrame(() => {
644
+ if (this.dialogContent) {
645
+ this.dialogContent.focus();
646
+ }
647
+ });
648
+ }
649
+
650
+ hide() {
651
+ this.dialogContent.classList.remove('is-open');
652
+ this.overlay.classList.remove('is-open');
653
+ this.setAttribute('aria-hidden', 'true');
654
+ window.zzUnlockBodyScroll && window.zzUnlockBodyScroll();
655
+ document.removeEventListener('keydown', this.handleDocumentKeydown);
656
+
657
+ if (
658
+ this.previousActiveElement &&
659
+ typeof this.previousActiveElement.focus === 'function'
660
+ ) {
661
+ this.previousActiveElement.focus();
662
+ }
663
+ }
664
+
665
+ handleOverlayClick() {
666
+ this.hide();
667
+ }
668
+
669
+ handleCloseClick() {
670
+ console.log('click-close');
671
+ this.hide();
672
+ }
673
+
674
+ handleDocumentKeydown(event) {
675
+ if (event.key === 'Escape') {
676
+ this.hide();
677
+ }
678
+ }
679
+ }
680
+
681
+ customElements.define('zz-normal-modal', ZZNormalModal);
682
+ }
@@ -100,6 +100,12 @@
100
100
  "label": "移动端视频",
101
101
  "visible_if": "{{ block.settings.bg_type == 'video' }}"
102
102
  },
103
+ {
104
+ "type": "text",
105
+ "id": "class_text",
106
+ "label": "class 名称",
107
+ "info": "添加自定义class名称,用于样式控制"
108
+ },
103
109
  ],
104
110
  "presets": [
105
111
  {
@@ -111,7 +117,7 @@
111
117
 
112
118
 
113
119
 
114
- <div class="zz-card-inner tw-relative">
120
+ <div class="zz-card-inner tw-relative {{ block.settings.class_text }}">
115
121
  <div class="main-face tw-w-full tw-h-full">
116
122
  {% render 'zz-img',
117
123
  pc_image: block.settings.desktop_image,
@@ -142,6 +142,11 @@
142
142
  #shopify-block-{{block.id}} .zz-normal-swiper .swiper-slide.swiper-slide-duplicate-active .zz-slide-scale-target {
143
143
  transform: scale(1.1);
144
144
  }
145
+ {% if block.settings.click_to_switch %}
146
+ #shopify-block-{{block.id}} .zz-normal-swiper .swiper-slide {
147
+ cursor: pointer;
148
+ }
149
+ {% endif %}
145
150
  }
146
151
 
147
152
  {% endif %}
@@ -488,6 +493,16 @@
488
493
  initialized = true;
489
494
  instance = new Swiper(swiperSelector, options);
490
495
  if (swiperWrapper) swiperWrapper.classList.remove('tw-invisible');
496
+ {% if block.settings.click_to_switch %}
497
+ swiperWrapper.addEventListener('click', (e) => {
498
+ const slide = e.target.closest('.swiper-slide');
499
+ if (!slide) return;
500
+ const realIndex = slide.getAttribute('data-swiper-slide-index');
501
+ instance.slideToLoop(realIndex);
502
+
503
+ });
504
+ {% endif %}
505
+
491
506
  }
492
507
 
493
508
  const root = block.querySelector(swiperSelector);
@@ -722,6 +737,13 @@
722
737
  "min": 1,
723
738
  "max": 6,
724
739
  "step": 1
740
+ },
741
+ {
742
+ "type": "checkbox",
743
+ "id": "click_to_switch",
744
+ "label": "是否点击切换",
745
+ "default": false,
746
+
725
747
  }
726
748
  ],
727
749
  "blocks": [
@@ -26,6 +26,9 @@
26
26
  border-radius: 16px;
27
27
  transition: background 0.3s ease;
28
28
  }
29
+ #shopify-block-{{block.id}} .switchCard-text {
30
+ height: 50px;
31
+ }
29
32
  #shopify-block-{{block.id}}:hover {
30
33
  background-color: transparent;
31
34
  background-image: url('{{ block.settings.bg_image | image_url }}');
@@ -69,7 +72,7 @@
69
72
  {% else %}
70
73
  <p class="tw-text-white tw-text-[20px]">{{ block.settings.product_name }}</p>
71
74
  {% endif %}
72
- <p class="tw-text-[16px] lg:tw-text-[20px] tw-leading-[1.25] tw-mt-[12px] lg:tw-mt-[24px] tw-text-white">{{ block.settings.description }}</p>
75
+ <p class="switchCard-text tw-text-[16px] lg:tw-text-[20px] tw-leading-[1.25] tw-mt-[12px] lg:tw-mt-[24px] tw-text-white">{{ block.settings.description }}</p>
73
76
  <div class="tw-flex tw-justify-center tw-gap-[15px] tw-items-center tw-mt-[24px] lg:tw-gap-[20px] lg:tw-mt-[30px]">
74
77
  <a class="tw-block tw-bg-white tw-text-center tw-flex-1 tw-text-black tw-text-[14px] tw-py-[10px] tw-rounded-[4px]"
75
78
  {% if block.settings.card_id != blank %} data-track-zz-element="{{ block.settings.card_id }}-left" {% endif %}
@@ -72,6 +72,11 @@
72
72
  "label": "是否点击播放",
73
73
  "default": false
74
74
  },
75
+ {
76
+ "type": "text",
77
+ "id": "module_id",
78
+ "label": "唯一业务id"
79
+ }
75
80
 
76
81
  ],
77
82
  "presets": [
@@ -108,7 +113,8 @@
108
113
  class: 'ratio-video tw-w-full tw-h-auto',
109
114
  autoplay: autoplay,
110
115
  loop: true,
111
- muted: muted
116
+ muted: muted,
117
+ module_id: block.settings.module_id
112
118
  %}
113
119
  {% if block.settings.if_click_play %}
114
120
  <div class="video-play-btn tw-absolute tw-top-[50%] tw-left-[50%] tw-translate-x-[-50%] tw-translate-y-[-50%]">
@@ -91,6 +91,11 @@
91
91
  "default": 10,
92
92
  "info": "单位:px"
93
93
  },
94
+ {
95
+ "type": "text",
96
+ "id": "module_id",
97
+ "label": "唯一业务id"
98
+ }
94
99
 
95
100
  ],
96
101
  "presets": [
@@ -121,7 +126,8 @@
121
126
  class: 'tw-w-full tw-h-auto',
122
127
  autoplay: true,
123
128
  loop: true,
124
- muted: true
129
+ muted: true,
130
+ module_id: block.settings.module_id
125
131
  %}
126
132
 
127
133
  </div>
@@ -0,0 +1,247 @@
1
+
2
+ <style>
3
+ .zz-scrollTrigger-block-{{ block.id }} {
4
+ width: 100%;
5
+ height: 100vh;
6
+ background-color: {{ block.settings.background_color }};
7
+ padding: 0;
8
+ margin: 0;
9
+ position: relative;
10
+ {% if block.settings.scroll_direction == 'horizontal' %}
11
+ display: flex;
12
+ overflow-x: hidden;
13
+ {% else %}
14
+ overflow: hidden;
15
+ {% endif %}
16
+ }
17
+ .zz-scrollTrigger-block-{{ block.id }} .zz-scrollTrigger-item .responsive-width-image,
18
+ .zz-scrollTrigger-block-{{ block.id }} .zz-scrollTrigger-item .zz-video {
19
+ aspect-ratio: 16 / 9 !important;
20
+ max-width: 45vw !important;
21
+ {% comment %} border-radius: 12px; {% endcomment %}
22
+ }
23
+
24
+ .zz-scrollTrigger-block-{{ block.id }} .zz-scrollTrigger-item .content-video-container {
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ {% comment %} border-radius: 12px; {% endcomment %}
29
+ }
30
+
31
+
32
+ {% if block.settings.scroll_direction == 'horizontal' %}
33
+ .zz-scrollTrigger-block-{{ block.id }} .zz-scrollTrigger-item {
34
+ width: 100vw;
35
+ height: 100vh;
36
+ flex-shrink: 0;
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ position: relative;
41
+ will-change: transform;
42
+ }
43
+ {% else %}
44
+ .zz-scrollTrigger-block-{{ block.id }} .zz-scrollTrigger-item {
45
+ width: 100%;
46
+ height: 100vh;
47
+ position: absolute;
48
+ top: 0;
49
+ left: 0;
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: center;
53
+ will-change: transform, opacity;
54
+ }
55
+ {% endif %}
56
+
57
+
58
+ @media (max-width: 768px) {
59
+ .zz-scrollTrigger-block-{{ block.id }} .zz-scrollTrigger-item {
60
+ height: 100vh;
61
+ width: 100%;
62
+ {% if block.settings.scroll_direction == 'horizontal' %}
63
+ width: 100vw;
64
+ padding: 0 10px;
65
+ {% else %}
66
+ padding: 0 10px;
67
+ {% endif %}
68
+ }
69
+ }
70
+ </style>
71
+
72
+ <div class="zz-scrollTrigger-block zz-scrollTrigger-block-{{ block.id }}" id="zz-scrollTrigger-block-{{ block.id }}">
73
+ {% for item in block.blocks %}
74
+ <div class="zz-scrollTrigger-item">
75
+ {% render item %}
76
+ </div>
77
+ {% endfor %}
78
+ </div>
79
+
80
+ <script>
81
+ document.addEventListener("DOMContentLoaded", () => {
82
+ if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') {
83
+ return;
84
+ }
85
+
86
+ gsap.registerPlugin(ScrollTrigger);
87
+ ScrollTrigger.config({
88
+ ignoreMobileResize: true,
89
+ autoRefreshEvents: "visibilitychange,DOMContentLoaded,load"
90
+ });
91
+
92
+ if (window.innerWidth < 1024) {
93
+ return;
94
+ }
95
+
96
+ let items = gsap.utils.toArray('#zz-scrollTrigger-block-{{ block.id }} .zz-scrollTrigger-item');
97
+ let scrollTriggerInstances = [];
98
+
99
+ if (items.length > 1) {
100
+ {% if block.settings.scroll_direction == 'horizontal' %}
101
+ const endValue = window.innerHeight * 1.3 * (items.length - 1);
102
+
103
+ const horizontalST = gsap.to(items, {
104
+ xPercent: -100 * (items.length - 1),
105
+ ease: 'none',
106
+ scrollTrigger: {
107
+ trigger: '#zz-scrollTrigger-block-{{ block.id }}',
108
+ start: 'top top',
109
+ end: `+=${endValue}`,
110
+ pin: true,
111
+ scrub: 1,
112
+ markers: false,
113
+ {% if block.settings.enable_snap %}
114
+ snap: {
115
+ snapTo: 1 / (items.length - 1),
116
+ duration: 0.5,
117
+ delay: 0.1,
118
+ directional: false,
119
+ ease: "power2.inOut"
120
+ },
121
+ {% endif %}
122
+ }
123
+ });
124
+ scrollTriggerInstances.push(horizontalST.scrollTrigger);
125
+ {% else %}
126
+ gsap.set(items[0], { y: 0, opacity: 1 });
127
+ gsap.set(items.slice(1), { y: '10vh', opacity: 0 });
128
+
129
+ const endValue = window.innerHeight * 1 * (items.length - 1); // 增加滚动距离让动画更平滑
130
+
131
+ let tl = gsap.timeline({
132
+ scrollTrigger: {
133
+ trigger: '#zz-scrollTrigger-block-{{ block.id }}',
134
+ start: 'top top',
135
+ end: `+=${endValue}`,
136
+ pin: true,
137
+ scrub: 1,
138
+ markers: false,
139
+ {% if block.settings.enable_snap %}
140
+ snap: {
141
+ snapTo: 1 / (items.length - 1),
142
+ duration: 0.2,
143
+ delay: 0.05,
144
+ directional: true,
145
+ ease: "power2.out"
146
+ },
147
+ {% endif %}
148
+ refreshPriority: -1,
149
+ }
150
+ });
151
+ scrollTriggerInstances.push(tl.scrollTrigger);
152
+
153
+ items.forEach((item, index) => {
154
+ if (index < items.length - 1) {
155
+ let currentItem = items[index];
156
+ let nextItem = items[index + 1];
157
+
158
+ tl.to(currentItem, {
159
+ y: '-10vh',
160
+ opacity: 0,
161
+ duration: 0.1,
162
+ ease: "power2.inOut"
163
+ })
164
+ .fromTo(nextItem, {
165
+ y: '10vh',
166
+ opacity: 0
167
+ }, {
168
+ y: 0,
169
+ opacity: 1,
170
+ duration: 0.1,
171
+ ease: "power2.inOut"
172
+ });
173
+ }
174
+ });
175
+ {% endif %}
176
+ }
177
+
178
+ window.addEventListener('beforeunload', () => {
179
+ scrollTriggerInstances.forEach(st => {
180
+ if (st) st.kill();
181
+ });
182
+ });
183
+
184
+ let resizeTimeout;
185
+ {% comment %} window.addEventListener('resize', () => {
186
+ clearTimeout(resizeTimeout);
187
+ resizeTimeout = setTimeout(() => {
188
+ ScrollTrigger.refresh();
189
+ }, 250);
190
+ }); {% endcomment %}
191
+ });
192
+ </script>
193
+
194
+ {% schema %}
195
+ {
196
+ "name": "ZZ ScrollTrigger Block",
197
+ "settings": [
198
+ {
199
+ "type": "select",
200
+ "id": "scroll_direction",
201
+ "label": "滚动方向",
202
+ "options": [
203
+ {
204
+ "value": "vertical",
205
+ "label": "上下切换"
206
+ },
207
+ {
208
+ "value": "horizontal",
209
+ "label": "左右切换"
210
+ }
211
+ ],
212
+ "default": "vertical",
213
+ "info": "选择滚动的方向模式"
214
+ },
215
+ {
216
+ "type": "checkbox",
217
+ "id": "enable_snap",
218
+ "label": "启用吸附",
219
+ "default": false
220
+ },
221
+ {
222
+ "type": "color_background",
223
+ "id": "background_color",
224
+ "label": "背景颜色",
225
+ "default": "transparent"
226
+ }
227
+ ],
228
+ "blocks": [
229
+ {
230
+ "type": "@theme"
231
+ }
232
+ ],
233
+ "presets": [
234
+ {
235
+ "name": "ScrollTrigger滚动容器Block",
236
+ "blocks": [
237
+ {
238
+ "type": "zz-title",
239
+ "settings": {
240
+ "pc_title": "<p>滚动容器Block</p>"
241
+ }
242
+ }
243
+ ]
244
+ }
245
+ ]
246
+ }
247
+ {% endschema %}
@@ -57,7 +57,8 @@
57
57
  class: 'image-video-box tw-w-full tw-h-auto ',
58
58
  autoplay: false,
59
59
  loop: true,
60
- muted: true
60
+ muted: true,
61
+ module_id: block.settings.block_module_id
61
62
  %}
62
63
  {% else %}
63
64
  {%
@@ -143,6 +144,13 @@
143
144
  "default": "#B2B2B2",
144
145
  "label": "内容颜色"
145
146
  },
147
+ {
148
+ "type": "text",
149
+ "id": "block_module_id",
150
+ "label": "唯一业务id",
151
+ "info": "需要唯一,埋点统计"
152
+ },
153
+
146
154
  ],
147
155
  "presets": [
148
156
  {
@@ -113,7 +113,7 @@
113
113
  pc_poster: block.settings.poster_pc,
114
114
  mb_video: video_mb,
115
115
  mb_poster: poster_mb,
116
- module_id: 'video-btn'
116
+ module_id: 'video-btn-popup'
117
117
  %}
118
118
 
119
119
  {% if block.settings.type == 'primary' %}