-
-
Save kobitoDevelopment/50ed33636fa4cadf5b816e0cbdb05aa5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="container"> | |
| <div class="hoge box"></div> | |
| <div class="fuga box"></div> | |
| <div class="piyo box"></div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .container { | |
| scroll-snap-type: y mandatory; | |
| /* | |
| mandatory → 少しでもスクロールしたら次の要素にスナップ | |
| proximity → 半分までのスクロールは前の要素にスナップ + 半分の位置では停止 + 半分を超えると次の要素にスナップ | |
| */ | |
| overflow: auto; | |
| width: 100%; | |
| height: 100vh; | |
| .box { | |
| width: 100%; | |
| height: 100%; | |
| scroll-snap-align: start; | |
| &.hoge { | |
| background-color: yellow; | |
| } | |
| &.fuga { | |
| background-color: green; | |
| } | |
| &.piyo { | |
| background-color: orange; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment