Javascript로 처리를 했었던 스냅 처리를 CSS로 할 수 있게 속성이 추가가 됐습니다.
그 속성은 scroll-snap-type 속성입니다.
속성
scroll-snap-type: none;
scroll-snap-type: x;
scroll-snap-type: y;
scroll-snap-type: block;
scroll-snap-type: inline;
scroll-snap-type: both;
/* Optional mandatory | proximity*/
scroll-snap-type: x mandatory;
scroll-snap-type: y proximity;
scroll-snap-type: both mandatory;
<html>
<head>
<meta chartset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html, body {
height: 100vh;
overflow: hidden;
}
.parent {
overflow: scroll;
height: 100vh;
scroll-snap-type: y mandatory;
}
.part {
height: 100vh;
scroll-snap-align: start;
position: relative;
}
.one {
background-color: red;
}
.two {
background-color: blue;
}
.three {
background-color: grey;
}
.four {
background-color: green;
}
</style>
<head>
<body>
<div class="parent row">
<div class="part one">
</div>
<div class="part tow">
</div>
<div class="part three">
</div>
<div class="part four">
</div>
</div>
</body>
</html>
See the Pen by rarri01 (@rarri01) on CodePen.
속성
[Flutter] 버전 2.0.4 build Failed 발생 (0) | 2021.09.15 |
---|---|
[Flutter] Flavor를 통한 빌드 변형하기 (0) | 2021.09.08 |
[Flutter] VlcPlayer 플러그인 상태 값 (0) | 2021.07.14 |
[Flutter] VlcPlayer 무한 영상 재생 (0) | 2021.07.13 |
[Flutter] 탭 메뉴(Tab Menu) 만들기 (0) | 2021.06.24 |
댓글 영역