feat: Scroll snap

Enable scroll snap on home page with an option (default false)

Signed-off-by: Rémy Jacquin <remy@remyj.fr>
This commit is contained in:
Rémy Jacquin 2025-02-19 19:26:22 +01:00
parent aa91957832
commit 924324d4c1
No known key found for this signature in database
GPG key ID: BEEF3B9EC3E7FBE9
3 changed files with 27 additions and 9 deletions

View file

@ -1,20 +1,36 @@
/*
/*
Removed smooth scrolling implementation in main.js in favor of
simpler css approach.
See: https://css-tricks.com/snippets/jquery/smooth-scrolling/
See: https://css-tricks.com/snippets/jquery/smooth-scrolling/
*/
*,
html {
html,
:not(.dropdown) {
scroll-behavior: smooth !important;
overflow-y: hidden;
}
body {
position: relative;
overflow-y: scroll;
height: 100vh;
}
body.scroll-container {
scroll-snap-type: y mandatory;
}
/*
Enable scroll snap for home page
*/
div#home,
div.section-holder {
scroll-snap-align: start;
}
/*
Fixes anchor overlapping with header.
See: https://stackoverflow.com/questions/4086107/fixed-page-header-overlaps-in-page-anchors
See: https://stackoverflow.com/questions/4086107/fixed-page-header-overlaps-in-page-anchors
*/
:target::before {
content: '';