Animation CSS3: display + opacity

前端 未结 15 2747
轮回少年
轮回少年 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:13

    There is another good method to get this done by using pointer-events:

    .child {
        opacity: 0;
        pointer-events: none;
    
        -webkit-transition: opacity 0.5s ease-in-out;
        -moz-transition: opacity 0.5s ease-in-out;
        transition: opacity 0.5s ease-in-out;
    }
    
    .parent:hover .child {
        opacity: 0.9;
        pointer-events: all;
    }
    

    Unfortunately, this is not supported in IE10 and below.

    0 讨论(0)
  • 2020-11-27 12:13

    HOW TO ANIMATE OPACITY WITH CSS:
    this is my code:
    the CSS code

    .item {   
        height:200px;
        width:200px;
        background:red;
        opacity:0;
        transition: opacity 1s ease-in-out;
    }
    
    .item:hover {
        opacity: 1;
    }
    code {
        background: linear-gradient(to right,#fce4ed,#ffe8cc);
    }
    <div class="item">
    
    </div>
    <p><code> move mouse over top of this text</code></p>

    or check this demo file

    function vote(){
    var vote = getElementById("yourOpinion")
    if(this.workWithYou):
    vote += 1 };
    lol

    0 讨论(0)
  • 2020-11-27 12:17

    On absolute or fixed elements you could also use z-index:

    .item {
        position: absolute;
        z-index: -100;
    }
    
    .item:hover {
        z-index: 100;
    }
    

    Other elements should have a z-index between -100 and 100 now.

    0 讨论(0)
提交回复
热议问题