zz-shopify-components 0.15.1-beta.1 → 0.15.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
|
@@ -580,6 +580,7 @@
|
|
|
580
580
|
>
|
|
581
581
|
<div
|
|
582
582
|
id='{{ banner.id }}-bannerlink'
|
|
583
|
+
data-banner-name="{{ banner.settings.banner_name }}"
|
|
583
584
|
class='{{ banner.id }}-site-event swiper-content tw-w-full tw-max-w-screen tw-relative tw-text-left tw-h-full'
|
|
584
585
|
>
|
|
585
586
|
{%- if banner.type == 'img' -%}
|
|
@@ -703,10 +704,14 @@
|
|
|
703
704
|
const bannerlink = document.getElementById('{{ banner.id }}-bannerlink')
|
|
704
705
|
const eventList = document.querySelectorAll('.{{ banner.id }}-site-event')
|
|
705
706
|
if(button) {
|
|
707
|
+
{% if banner.settings.links != blank %}
|
|
706
708
|
bindSiteJump(button, {{ banner.settings.links | json }})
|
|
709
|
+
{% endif %}
|
|
707
710
|
}
|
|
708
711
|
if(bannerlink) {
|
|
712
|
+
{% if banner.settings.linksbanner != blank %}
|
|
709
713
|
bindSiteJump(bannerlink, {{ banner.settings.linksbanner | json }})
|
|
714
|
+
{% endif %}
|
|
710
715
|
}
|
|
711
716
|
console.log('eventList', eventList)
|
|
712
717
|
if(eventList) {
|
|
@@ -933,5 +938,37 @@
|
|
|
933
938
|
}
|
|
934
939
|
}
|
|
935
940
|
}
|
|
941
|
+
|
|
942
|
+
function handleBannerShow() {
|
|
943
|
+
// 监听滚动,高亮 tab
|
|
944
|
+
const observerOptions = {
|
|
945
|
+
root: null,
|
|
946
|
+
rootMargin: '0px 0px 0px 0px',
|
|
947
|
+
threshold: 0.5
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
const observer = new IntersectionObserver(entries => {
|
|
951
|
+
entries.forEach(entry => {
|
|
952
|
+
if (entry.isIntersecting) {
|
|
953
|
+
const bannerName = entry.target.dataset.bannerName;
|
|
954
|
+
console.log('banner_show', bannerName);
|
|
955
|
+
dataLayer.push({
|
|
956
|
+
event: "banner_show",
|
|
957
|
+
timestamp: new Date().toISOString(),
|
|
958
|
+
event_type_attribute: bannerName,
|
|
959
|
+
section_name: "swiper_banner_v3",
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
});
|
|
964
|
+
}, observerOptions);
|
|
965
|
+
|
|
966
|
+
const banner = document.querySelectorAll('[data-banner-name]');
|
|
967
|
+
banner.forEach(item => {
|
|
968
|
+
observer.observe(item);
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
}
|
|
972
|
+
handleBannerShow();
|
|
936
973
|
})
|
|
937
974
|
</script>
|