<div>用户名不存在</div>
假设这个div是一个提示,如何让这个div显示的时候能抖动一下,然后消失。
给这个div新增一个类(addClass)。
这个类的内容为抖动效果的css3动画。抖动可用translate+rotate+opacity实现。
最后设定时间再将类移除,setTimeout(时间即为动画时间)。
.animated {
animation-duration: 1s;
animation-fill-mode: both;
}
.animated.bounceOut {
animation-duration: .75s;
}
@keyframes bounceOut {
20% {
transform: scale3d(.9, .9, .9);
}
50%, 55% {
opacity: 1;
transform: scale3d(1.1, 1.1, 1.1);
}
to {
opacity: 0;
transform: scale3d(.3, .3, .3);
}
}
.bounceOut {
animation-name: bounceOut;
}
然后配合jQuery,效果应该就有了。
6 回答1.2k 阅读✓ 已解决
1 回答701 阅读
1 回答728 阅读
写了个简单的抖动,然后消失