<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
*,
*:before,
*:after {
box-sizing: border-box;
}
@-webkit-keyframes scrollBad {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -320px;
}
}
@-moz-keyframes scrollBad {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -320px;
}
}
@keyframes scrollBad {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -320px;
}
}
@-webkit-keyframes scrollGood {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-320px);
}
}
@-moz-keyframes scrollGood {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-320px);
}
}
@keyframes scrollGood {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-320px);
}
}
.pen {
background-color: blue;
position: absolute;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
}
.panel {
padding: 3rem;
height: 50%;
}
.top {
background-color:
background-image: url(http://scarbroughstudios.com/img/codepen.svg);
background-position: center center;
background-size: 500px;
-webkit-animation: scrollBad 5s linear infinite;
-moz-animation: scrollBad 5s linear infinite;
animation: scrollBad 5s linear infinite;
}
.bottom {
background-color:
overflow: hidden;
position: relative;
}
.bottom .scroll {
background-image: url(http://scarbroughstudios.com/img/codepen.svg);
background-position: center center;
background-size: 500px;
position: absolute;
top: 0px;
left: 0px;
height: 400%;
width: 100%;
z-index: 1;
-webkit-animation: scrollGood 5s linear infinite;
-moz-animation: scrollGood 5s linear infinite;
animation: scrollGood 5s linear infinite;
}
h1 {
color: white;
font-weight: 400;
font-family: sans-serif;
margin: 0;
position: relative;
z-index: 2;
}
</style>
<script>
</script>
</head>
<body>
<section class="pen">
<div class="panel top">
<h1>Animate: background-position</h1>
</div>
<div class="panel bottom">
<h1>Animate: translateY</h1>
<div class="scroll">fdsfjkdsjf djf dskl</div>
</div>
</section>
</body>
</html>