Use ZenScroll for smooth scroll on anchors
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
// Dependencies
|
// Dependencies
|
||||||
import * as basicScroll from 'basicscroll'
|
import * as basicScroll from 'basicscroll'
|
||||||
import AOS from 'aos'
|
import AOS from 'aos'
|
||||||
|
import zenscroll from 'zenscroll'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import Button from '../atoms/Button'
|
import Button from '../atoms/Button'
|
||||||
@@ -110,7 +111,7 @@
|
|||||||
<div class="intro__description style-description">
|
<div class="intro__description style-description">
|
||||||
<p>{$site.description}</p>
|
<p>{$site.description}</p>
|
||||||
|
|
||||||
<Button type="a" href="#choose" class="button" text="Explore locations" on:click={e => fn.smoothScroll(e, '#choose')}>
|
<Button type="a" href="#choose" class="button" text="Explore locations">
|
||||||
<IconGlobeSmall width="22" color="#666" />
|
<IconGlobeSmall width="22" color="#666" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -57,19 +57,6 @@ export const isInViewport = element => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Smooth Scroll
|
|
||||||
*/
|
|
||||||
export const smoothScroll = (event, element = null) => {
|
|
||||||
document.querySelector(element).scrollIntoView({
|
|
||||||
behavior: 'smooth',
|
|
||||||
block: 'start'
|
|
||||||
})
|
|
||||||
event.preventDefault()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Random String Generator
|
** Random String Generator
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user