fix: scrolling to top when changing pages
This commit is contained in:
parent
af9380365d
commit
8a359ae310
@ -8,7 +8,7 @@ export let pageAmount: number;
|
|||||||
<Pagination class="mx-auto" arialabel="member list page navigation">
|
<Pagination class="mx-auto" arialabel="member list page navigation">
|
||||||
{#if currentPage !== 1}
|
{#if currentPage !== 1}
|
||||||
<PaginationItem>
|
<PaginationItem>
|
||||||
<PaginationLink href="#" previous on:click={() => currentPage -= 1}></PaginationLink>
|
<PaginationLink href="#" previous on:click={(e) => {e.preventDefault(); currentPage -= 1}}></PaginationLink>
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{:else}
|
{:else}
|
||||||
<PaginationItem disabled>
|
<PaginationItem disabled>
|
||||||
@ -17,12 +17,12 @@ export let pageAmount: number;
|
|||||||
{/if}
|
{/if}
|
||||||
{#if currentPage > 2}
|
{#if currentPage > 2}
|
||||||
<PaginationItem>
|
<PaginationItem>
|
||||||
<PaginationLink href="#" on:click={() => currentPage = 1}>1</PaginationLink>
|
<PaginationLink href="#" on:click={(e) => {e.preventDefault(); currentPage = 1}}>1</PaginationLink>
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{/if}
|
{/if}
|
||||||
{#if currentPage === 4}
|
{#if currentPage === 4}
|
||||||
<PaginationItem>
|
<PaginationItem>
|
||||||
<PaginationLink href="#" on:click={() => currentPage = 2}>2</PaginationLink>
|
<PaginationLink href="#" on:click={(e) => {e.preventDefault(); currentPage = 2}}>2</PaginationLink>
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{/if}
|
{/if}
|
||||||
{#if currentPage > 4}
|
{#if currentPage > 4}
|
||||||
@ -32,7 +32,7 @@ export let pageAmount: number;
|
|||||||
{/if}
|
{/if}
|
||||||
{#if currentPage > 1}
|
{#if currentPage > 1}
|
||||||
<PaginationItem>
|
<PaginationItem>
|
||||||
<PaginationLink href="#" on:click={() => currentPage -= 1}>{currentPage - 1}</PaginationLink>
|
<PaginationLink href="#" on:click={(e) => {e.preventDefault(); currentPage -= 1}}>{currentPage - 1}</PaginationLink>
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{/if}
|
{/if}
|
||||||
<PaginationItem active>
|
<PaginationItem active>
|
||||||
@ -40,7 +40,7 @@ export let pageAmount: number;
|
|||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{#if currentPage < pageAmount}
|
{#if currentPage < pageAmount}
|
||||||
<PaginationItem>
|
<PaginationItem>
|
||||||
<PaginationLink href="#" on:click={() => currentPage += 1}>{currentPage + 1}</PaginationLink>
|
<PaginationLink href="#" on:click={(e) => {e.preventDefault(); currentPage += 1}}>{currentPage + 1}</PaginationLink>
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{/if}
|
{/if}
|
||||||
{#if currentPage < pageAmount - 3}
|
{#if currentPage < pageAmount - 3}
|
||||||
@ -50,21 +50,22 @@ export let pageAmount: number;
|
|||||||
{/if}
|
{/if}
|
||||||
{#if currentPage === pageAmount - 3}
|
{#if currentPage === pageAmount - 3}
|
||||||
<PaginationItem>
|
<PaginationItem>
|
||||||
<PaginationLink href="#" on:click={() => currentPage = pageAmount - 1}>{pageAmount - 1}</PaginationLink>
|
<PaginationLink href="#" on:click={(e) => {e.preventDefault(); currentPage = pageAmount - 1}}>{pageAmount - 1}</PaginationLink>
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{/if}
|
{/if}
|
||||||
{#if currentPage < pageAmount - 1}
|
{#if currentPage < pageAmount - 1}
|
||||||
<PaginationItem>
|
<PaginationItem>
|
||||||
<PaginationLink href="#" on:click={() => currentPage = pageAmount}>{pageAmount}</PaginationLink>
|
<PaginationLink href="#" on:click={(e) => { e.preventDefault(); currentPage = pageAmount}}>{pageAmount}</PaginationLink>
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{/if}
|
{/if}
|
||||||
{#if currentPage !== pageAmount}
|
{#if currentPage !== pageAmount}
|
||||||
<PaginationItem>
|
<PaginationItem>
|
||||||
<PaginationLink href="#" next on:click={() => currentPage += 1}></PaginationLink>
|
<PaginationLink href="#" next on:click={(e) => {e.preventDefault(); currentPage += 1}}></PaginationLink>
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{:else}
|
{:else}
|
||||||
<PaginationItem disabled>
|
<PaginationItem disabled>
|
||||||
<PaginationLink next></PaginationLink>
|
<PaginationLink next></PaginationLink>
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
{/if}
|
{/if}
|
||||||
</Pagination>
|
</Pagination>
|
||||||
|
{/if}
|
Loading…
Reference in New Issue
Block a user