Remove/Hide div from DOM after animation completes using CSS?

前端 未结 3 1593
南笙
南笙 2021-02-09 04:37

I have an animation where a div slides out the view, however when the animation is completed, the div just returns to its origin position in the view. How do I totally remove th

3条回答
  •  孤街浪徒
    2021-02-09 05:07

    animation: slide 5s linear forwards;
    

    at 100%

    opacity: 0;
    display: none;
    

    Try this.

    Working fiddle: https://jsfiddle.net/jbtfdjyy/1/

    UPDATE: JS mani

    var slideBox = document.getElementById('slide-box');
    
    setTimeout(function(){
        slideBox.style.display = 'none';
    }, 5000); 
    

    Try this. https://jsfiddle.net/jbtfdjyy/2/

提交回复
热议问题