@yatoday/astro-ui 0.17.27 → 0.17.28
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.
|
@@ -235,6 +235,23 @@ const { container: containerClass = '', swiper: swiperClass = '', swiperThumb: s
|
|
|
235
235
|
|
|
236
236
|
// Mark as initialized to show content and hide loader
|
|
237
237
|
elem.setAttribute('data-initialized', 'true');
|
|
238
|
+
|
|
239
|
+
// Force Swiper to re-measure once layout settles and again as images
|
|
240
|
+
// resolve. Without this, Swiper can measure slides while their
|
|
241
|
+
// <img> children still have no intrinsic size (loading="lazy" /
|
|
242
|
+
// cache-cold) and then lock itself via watchOverflow — silently
|
|
243
|
+
// swallowing every slideTo() and click handler on user machines
|
|
244
|
+
// where the images aren't already cached.
|
|
245
|
+
const scheduleUpdate = () => {
|
|
246
|
+
const s = (mainSwiperEl as any)?.swiper;
|
|
247
|
+
if (s && !s.destroyed) s.update();
|
|
248
|
+
};
|
|
249
|
+
requestAnimationFrame(scheduleUpdate);
|
|
250
|
+
mainSwiperEl.querySelectorAll('img').forEach((img) => {
|
|
251
|
+
if (img.complete && img.naturalWidth > 0) return;
|
|
252
|
+
img.addEventListener('load', scheduleUpdate, { once: true });
|
|
253
|
+
img.addEventListener('error', scheduleUpdate, { once: true });
|
|
254
|
+
});
|
|
238
255
|
});
|
|
239
256
|
};
|
|
240
257
|
|
|
@@ -76,6 +76,23 @@
|
|
|
76
76
|
|
|
77
77
|
// Mark as initialized to show content and hide loader
|
|
78
78
|
elem.setAttribute('data-initialized', 'true');
|
|
79
|
+
|
|
80
|
+
// Force Swiper to re-measure once layout settles and again as images
|
|
81
|
+
// resolve. Without this, Swiper can measure slides while their
|
|
82
|
+
// <img> children still have no intrinsic size (loading="lazy" /
|
|
83
|
+
// cache-cold) and then lock itself via watchOverflow — silently
|
|
84
|
+
// swallowing every slideTo() and click handler on user machines
|
|
85
|
+
// where the images aren't already cached.
|
|
86
|
+
const scheduleUpdate = () => {
|
|
87
|
+
const s = (mainSwiperEl as any)?.swiper;
|
|
88
|
+
if (s && !s.destroyed) s.update();
|
|
89
|
+
};
|
|
90
|
+
requestAnimationFrame(scheduleUpdate);
|
|
91
|
+
mainSwiperEl.querySelectorAll('img').forEach((img) => {
|
|
92
|
+
if (img.complete && img.naturalWidth > 0) return;
|
|
93
|
+
img.addEventListener('load', scheduleUpdate, { once: true });
|
|
94
|
+
img.addEventListener('error', scheduleUpdate, { once: true });
|
|
95
|
+
});
|
|
79
96
|
};
|
|
80
97
|
|
|
81
98
|
init();
|