0

これには問題があります。ページが読み込まれると最初のアニメーションは正常に動作しますが、フィギュア要素にカーソルを合わせたときに別のアニメーションをトリガーしたいのですが、これを行うと最初のアニメーションが繰り返されますが、どうやら、マウスを置くと赤いボックスの上に置いて強制的に元の位置に移動すると、2 番目のアニメーションが機能します:/

キーフレームを使用すると、要素は最初の位置に属しますか? 私はそれを絶対にしましたが、同じことです。ここで動作するコードを見ることができます: http://jsfiddle.net/zhk7w/ 手をありがとう!

<div id="wrapper">
        <article>
            <div id="sharing-wrapper">
                <figure>
                <a class="animate" href="#">p</a>
                </figure>

            </div>
            <div class="test">
                <a class="test" href="">C</a>
            </div>
        </article>
    </div>

そしてcss:

#sharing-wrapper figure{
margin-left: 50px;
position: relative;
width: 20px;
height: 20px;
}
#sharing-wrapper figure{
padding: 15px;
background-color: red;
position: relative;
-webkit-animation-name:animatetopbottom,animateleft;
-webkit-animation-duration:3s,3s;
-webkit-animation-fill-mode:forwards;
/*-webkit-animation-direction:alternate;*/
}
#sharing-wrapper figure:hover{
-webkit-animation: shakeit 1s;}

アニメーション:

    @-webkit-keyframes animateleft{
    from {left: 0px;}
    to {left: 50px;}
}

@-webkit-keyframes animatetopbottom{
    0% {top: 0px;}
    10% {top: 90px;}
    20% {top: 60px;-webkit-transform:rotate(680grad);}
    30% {top: 90px;-webkit-transform:scale(0.7);}
    40% {-webkit-transform:scale(1.5);}
    50% {top: 60px;-webkit-transform:rotate(0grad);}
    80% {top: 80px;}
    100% {top: 80px;}

}



    @-webkit-keyframes shakeit{
    from { top: 25px; }
    to { top: -40px; }
    }
4

1 に答える 1