mirror of https://github.com/Lissy93/dashy.git
Smooth scrolling
This commit is contained in:
parent
305769adce
commit
c25e346b35
|
@ -10,6 +10,10 @@ import IconBannerSource from '../../static/icons/banner_source.svg';
|
||||||
import IconBannerDocs from '../../static/icons/banner_docs.svg';
|
import IconBannerDocs from '../../static/icons/banner_docs.svg';
|
||||||
import IconDownArrow from '../../static/icons/interface_down.svg';
|
import IconDownArrow from '../../static/icons/interface_down.svg';
|
||||||
|
|
||||||
|
const scrollToFeatures = () => {
|
||||||
|
document.querySelector('#go-down').scrollIntoView({ behavior: 'smooth' });
|
||||||
|
};
|
||||||
|
|
||||||
export default function HomepageHeader() {
|
export default function HomepageHeader() {
|
||||||
const { siteConfig } = useDocusaurusContext();
|
const { siteConfig } = useDocusaurusContext();
|
||||||
const [showMore, setShowMore] = useState(false);
|
const [showMore, setShowMore] = useState(false);
|
||||||
|
@ -40,7 +44,7 @@ export default function HomepageHeader() {
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{(!showMore) &&
|
{(!showMore) &&
|
||||||
<a href="#go-down" className={styles.scrollDown} id="go-down">
|
<a onClick={scrollToFeatures} className={styles.scrollDown} id="go-down">
|
||||||
<IconDownArrow className={styles.scrollDownIcon} />
|
<IconDownArrow className={styles.scrollDownIcon} />
|
||||||
<span className={styles.scrollDownText}>Feature List</span>
|
<span className={styles.scrollDownText}>Feature List</span>
|
||||||
<IconDownArrow className={styles.scrollDownIcon} />
|
<IconDownArrow className={styles.scrollDownIcon} />
|
||||||
|
|
|
@ -60,6 +60,10 @@ nav.navbar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue