We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fad2aaa commit 2567905Copy full SHA for 2567905
src/lib/holocene/pagination.svelte
@@ -54,9 +54,8 @@
54
let height: number | undefined;
55
56
onMount(() => {
57
- if (floatId) {
58
- width = document.getElementById(floatId)?.clientWidth;
59
- }
+ updateWidth();
+
60
if (startingIndex > 0) {
61
handlePageChange();
62
}
@@ -70,10 +69,16 @@
70
69
});
71
};
72
+ const updateWidth = () => {
73
+ if (floatId) {
74
+ width = document.getElementById(floatId)?.clientWidth;
75
+ }
76
+ };
77
78
$: floatStyle = getFloatStyle({ width, height, screenWidth });
79
</script>
80
-<svelte:window bind:innerWidth={screenWidth} />
81
+<svelte:window bind:innerWidth={screenWidth} on:resize={updateWidth} />
82
83
<div class="pagination relative mb-8 flex flex-col gap-4">
84
<div
0 commit comments