[英]Is there a way to move a html element from a div to another div using react?
如何将 HTML 元素从 div 移动到 React 中的另一个 div 元素。
当元素从一个 div 移动到另一个 div 时,我想要一个 animation。 如果可以,请提出步骤。
我的建议是
如果您想花哨并想要一个实际的 animation 元素移动,我建议您这样做:
#element{
animation: move 10s;
-moz-animation: move 10s;
/* Firefox */
-webkit-animation: move 10s;
/* Safari and Chrome */
-o-animation: move 10s;
/* Opera */
}
@keyframes move {
0%{
position: absolute;
bottom: 20px;
}
50%{
position: absolute;
bottom: 80px;
}
100%{
position: absolute;
bottom: 140px;
}
@-moz-keyframes move {
/* Firefox */
0%{
position: absolute;
bottom: 20px;
}
50%{
position: absolute;
bottom: 80px;
}
100%{
position: absolute;
bottom: 140px;
}
}
@-webkit-keyframes move {
/* Safari and Chrome */
0%{
position: absolute;
bottom: 20px;
}
50%{
position: absolute;
bottom: 80px;
}
100%{
position: absolute;
bottom: 140px;
}
}
@-o-keyframes move {
/* Opera */
0%{
position: absolute;
bottom: 20px;
}
50%{
position: absolute;
bottom: 80px;
}
100%{
position: absolute;
bottom: 140px;
}
}
您可能需要调整定位和时间,但是这样的事情可以使元素在 React 中创建后立即开始移动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.