@yatoday/astro-ui 0.17.25 → 0.17.27
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.
|
@@ -190,12 +190,15 @@ const { container: containerClass = '', swiper: swiperClass = '', swiperThumb: s
|
|
|
190
190
|
const thumbSwiperEl = document.getElementById(`swiper-thumb-${id}`);
|
|
191
191
|
if (!mainSwiperEl || !thumbSwiperEl) return;
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
// Wire up thumb hover + click → main slide navigation.
|
|
194
|
+
// Attach to light-DOM swiper-slide elements directly so this does not
|
|
195
|
+
// depend on the swiperafterinit lifecycle event (which can be flaky with
|
|
196
|
+
// dynamically registered swiper-element + init="false").
|
|
197
|
+
const thumbSlides = thumbSwiperEl.querySelectorAll('swiper-slide');
|
|
198
|
+
thumbSlides.forEach((slide, index) => {
|
|
199
|
+
const goTo = () => (mainSwiperEl as any)?.swiper?.slideTo(index);
|
|
200
|
+
slide.addEventListener('mouseenter', goTo);
|
|
201
|
+
slide.addEventListener('click', goTo);
|
|
199
202
|
});
|
|
200
203
|
|
|
201
204
|
// Thumb Slider navigation buttons
|
|
@@ -32,12 +32,15 @@
|
|
|
32
32
|
const thumbSwiperEl = document.getElementById(`swiper-thumb-${id}`);
|
|
33
33
|
if (!mainSwiperEl || !thumbSwiperEl) return;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
// Wire up thumb hover + click → main slide navigation.
|
|
36
|
+
// Attach to light-DOM swiper-slide elements directly so this does not
|
|
37
|
+
// depend on the swiperafterinit lifecycle event (which can be flaky with
|
|
38
|
+
// dynamically registered swiper-element + init="false").
|
|
39
|
+
const thumbSlides = thumbSwiperEl.querySelectorAll('swiper-slide');
|
|
40
|
+
thumbSlides.forEach((slide, index) => {
|
|
41
|
+
const goTo = () => (mainSwiperEl as any)?.swiper?.slideTo(index);
|
|
42
|
+
slide.addEventListener('mouseenter', goTo);
|
|
43
|
+
slide.addEventListener('click', goTo);
|
|
41
44
|
});
|
|
42
45
|
|
|
43
46
|
// Thumb Slider navigation buttons
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yatoday/astro-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.17.
|
|
4
|
+
"version": "0.17.27",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "husky",
|
|
7
7
|
"pre-commit": "lint-staged",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"lodash.merge": "^4.6.2",
|
|
30
30
|
"photoswipe": "^5.4.4",
|
|
31
|
-
"swiper": "^
|
|
31
|
+
"swiper": "^12.1.2",
|
|
32
32
|
"unpic": "^3.22.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|