Skip to content

Instantly share code, notes, and snippets.

@fphilipe
Last active Aug 29, 2015
Embed
What would you like to do?
<!DOCTYPE html>
<html>
<head>
<title>Scroll Snap &amp; Backdrop Filter</title>
<meta content='width=device-width, initial-scale=1.0' name='viewport' />
<style>
body {
margin: 0;
padding-top: 10vh;
font: 5em 'Helvetica Neue', Helvetica, sans-serif;
font-weight: 100;
text-align: center;
color: white;
-webkit-scroll-snap-type: mandatory;
scroll-snap-type: mandatory;
-webkit-scroll-snap-destination: 50% 55%;
scroll-snap-destination: 50% 55%;
}
h1 {
margin: 0;
height: 10vh;
line-height: 10vh;
position: fixed;
left: 0;
top: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
font-size: 0.33em;
font-weight: inherit;
-webkit-backdrop-filter: blur(2px);
backdrop-filter: blur(2px);
}
.slide {
height: 90vh;
line-height: 90vh;
background-image: url(http://www.transparenttextures.com/patterns/asfalt-dark.png);
-webkit-scroll-snap-coordinate: 50% 50%;
scroll-snap-coordinate: 50% 50%;
}
.slide:nth-of-type(1) { background-color: tomato }
.slide:nth-of-type(2) { background-color: cadetblue }
.slide:nth-of-type(3) { background-color: plum }
.slide:nth-of-type(4) { background-color: cornflowerblue }
</style>
</head>
<body>
<h1>Scroll Snap &amp; Backdrop Filter</h1>
<div class='slide'>Slide 1</div>
<div class='slide'>Slide 2</div>
<div class='slide'>Slide 3</div>
<div class='slide'>Slide 4</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment