Avoid route change scroll when clicking on links
sapper-noscroll here for the rescue, keeps the scroll position and loads the new page content
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
export let href = '#'
|
||||
export let type = 'a'
|
||||
export let text = ''
|
||||
export let noScroll = null
|
||||
</script>
|
||||
|
||||
{#if type === 'button'}
|
||||
@@ -13,7 +14,7 @@
|
||||
</button>
|
||||
|
||||
{:else}
|
||||
<a {href} class={$$props.class ? $$props.class : 'button'} on:click>
|
||||
<a {href} class={$$props.class ? $$props.class : 'button'} sapper-noscroll={noScroll} on:click>
|
||||
<slot></slot>
|
||||
<div class="text" data-text={text}>
|
||||
<span>{text}</span>
|
||||
|
||||
Reference in New Issue
Block a user