Skip to content

Instantly share code, notes, and snippets.

@WallenHan
Last active May 31, 2018 09:42
Show Gist options
  • Save WallenHan/515a1947dac49bca8880415be47ce3cc to your computer and use it in GitHub Desktop.
Save WallenHan/515a1947dac49bca8880415be47ce3cc to your computer and use it in GitHub Desktop.
JS Bin// source https://jsbin.com/wagegapivo 实现无间隙的滚屏动画 css
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
div, p {
margin: 0;
padding: 0;
}
.container {
outline: 1px solid blue;
height: 200px;
/* 注释这行看整体效果 */
overflow: hidden;
}
.wrap {
animation: scroll 5s infinite linear;
}
.wrap:hover {
animation-play-state: paused;
}
@keyframes scroll {
0% {
transform: translate(0, 0)
}
100% {
transform: translate(0, -50%);
}
}
</style>
</head>
<body>
<div class="container">
<div class="wrap">
<div class="box1">
<p>000000001</p>
<p>000000002</p>
<p>000000003</p>
<p>000000004</p>
<p>000000005</p>
<p>000000006</p>
<p>000000007</p>
<p>000000008</p>
<p>000000009</p>
<p>000000010</p>
</div>
<div class="box2">
<p>000000001</p>
<p>000000002</p>
<p>000000003</p>
<p>000000004</p>
<p>000000005</p>
<p>000000006</p>
<p>000000007</p>
<p>000000008</p>
<p>000000009</p>
<p>000000010</p>
</div>
</div>
</div>
<script id="jsbin-source-css" type="text/css">div, p {
margin: 0;
padding: 0;
}
.container {
outline: 1px solid blue;
height: 200px;
/* 注释这行看整体效果 */
overflow: hidden;
}
.wrap {
animation: scroll 5s infinite linear;
}
.wrap:hover {
animation-play-state: paused;
}
@keyframes scroll {
0% {
transform: translate(0, 0)
}
100% {
transform: translate(0, -50%);
}
}
</script>
</body>
</html>
div, p {
margin: 0;
padding: 0;
}
.container {
outline: 1px solid blue;
height: 200px;
/* 注释这行看整体效果 */
overflow: hidden;
}
.wrap {
animation: scroll 5s infinite linear;
}
.wrap:hover {
animation-play-state: paused;
}
@keyframes scroll {
0% {
transform: translate(0, 0)
}
100% {
transform: translate(0, -50%);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment