Animation CSS3: display + opacity

前端 未结 15 2953
轮回少年
轮回少年 2020-11-27 11:42

I have got a problem with a CSS3 animation.

.child {
    opacity: 0;
    display: none;

    -webkit-transition: opacity 0.5s ease-in-out;
    -moz-transit         


        
15条回答
  •  鱼传尺愫
    2020-11-27 12:07

    One thing that I did was set the initial state's margin to be something like "margin-left: -9999px" so it does not appear on the screen, and then reset "margin-left: 0" on the hover state. Keep it "display: block" in that case. Did the trick for me :)

    Edit: Save the state and not revert to previous hover state? Ok here we need JS:

    
    
    
    

提交回复
热议问题