【发布时间】:2018-07-15 16:02:15
【问题描述】:
我正在尝试创建类似加载的效果,但我不确定这是否是正确的方法。
我正在尝试从左到右对其进行动画处理,但它既不是从左开始也不是从右结束。它从 DIV 溢出。我尝试使用overflow: hidden 和left: 0,但这也不起作用。显然,我的方法是错误的或遗漏了什么。请帮忙。
这是我目前所拥有的:JSFIDDLE DEMO
.timeline__story {
width: 100%;
background-color: #f3f3f3;
border: 1px solid #aaa;
padding: 15px;
}
.timeline__blank {
position: relative;
}
.timeline__blink {
width: 100%;
height: 100%;
position: absolute;
animation: joey 3s ease-in-out infinite;
background: -moz-linear-gradient(-65deg, transparent 0%, transparent 45%, transparent 48%, #A5C8E5 50%, transparent 52%, transparent 55%, transparent 0%);
background: -webkit-linear-gradient(-65deg, transparent 0%, transparent 45%, transparent 48%, #A5C8E5 50%, transparent 52%, transparent 55%, transparent 0%);
background: linear-gradient(-65deg, transparent 0%, transparent 45%, transparent 48%, #A5C8E5 50%, transparent 52%, transparent 55%, transparent 0%);
background-repeat: no-repeat;
z-index: 1;
}
@keyframes joey {
0% {left: 0; top: 0;}
50% {left: 50%; top: 0;}
100% {left: 0; top: 0;}
}
<div class="timeline__story timeline__blank">
<div class="timeline__blink"> </div>
<div>
This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text. This is a sample text.
</div>
</div>
【问题讨论】:
-
这是你想做的吗? -- w3schools.com/howto/howto_css_loader.asp
-
是的,我正在尝试创建一个加载器,但具有不同的动画效果,如我的 JSFiddle 所示。
-
你能告诉效果名称吗?
-
这里有更多选项 -- w3schools.com/css/css3_transitions.asp
-
你能看到我在JSFIDDLE中做的效果吗?它溢出并试图解决这个问题。不寻找其他效果。
标签: html css css-transitions css-animations