animation怎么让这个元素暂停运动?

元素用的绝对定位 高度180px 鼠标移入时让元素从-180px运动到0px
可是我下面这样的话运动到0px时就消失了怎么办? 鼠标移出时又闪现出来了 运动到了-180px
我这个应该怎样改才能让它运动到0px时就停止运动 鼠标移出时再回去

@keyframes toTop
    {
        from {bottom: -180px;}
        to {bottom: 0;}
    }
    @-webkit-keyframes toTop
    {
        from {bottom: -180px;}
        to {bottom: 0;}
    }
    @keyframes toBottom
    {
        from {bottom: 0px;}
        to {bottom: -180px;}
    }
    @-webkit-keyframes toBottom
    {
        from {bottom: 0px;}
        to {bottom: -180px;}
    }
阅读 1.2k
1 个回答

嵌套一层,父级定高,父级hover,子级移动。


image.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题