ここは私のCSSです。最初の質問ですが、私はdivが瞬時にではなくフェードインとフェードアウトするときに発生するエフェクトを欲しがります。私はトランジションを使用しようとしましたが、要素のデザインが混乱しているようですので、私は立ち往生しています。CSS要素の効果をフェードインする方法は?
私の2番目の質問は、(参考のためにここにある:https://jsfiddle.net/ojvym9cm/2/)、 'do'キーアニメーションが発生した後にホバー効果を発生させることは可能ですか?私はdivがアニメーション化している間、ホバー効果を起こさせたくありません。
私の第三の質問は、なぜアニメーションは、私は「半分」のdivをクリックしただけの直後に起こって代わりにされていますか? (参考のために)。申し訳ありませんが、これは私がちょうどこの時間を無駄にしないように何時間も過ごしたことがたくさんあります。要素ルールともホバールールの両方でtransition: opacity 300ms;
:あなたが必要となります。これを行うにFirst question, I want the effects that occur when the div is hovered above to fade in and out, rather than it being instant. I tried to use transitions, but it seems to mess with the design of the element, so I'm stuck.
:この質問に答えるために
#middle {
width: 100px;
height: 100px;
top: 0;
left: 50%;
display: block;
position: fixed;
border-radius: 150px;
background: powderblue;
animation: do 4s 1 ease;
-webkit-animation-fill-mode: forwards;
}
#middle:hover {
width: 96px;
height: 48px;
left: 50%;
top: 30%;
position: fixed;
border-color: powderblue;
border-style: solid;
border-width: 2px 2px 50px 2px;
border-radius: 100%;
z-index: 1000;
background: white;
}
#middle:hover:before {
content: "";
position: absolute;
top: 50%;
left: 0;
background: white;
border: 18px solid powderblue;
border-radius: 100%;
width: 12px;
height: 12px;
}
#middle:hover:after {
content: "";
position: absolute;
top: 50%;
left: 50%;
background: powderblue;
border: 18px solid white;
border-radius: 100%;
width: 12px;
height: 12px;
}
回答3 jqueryが必要です。もし私がjunkeryをフィディドに含めると、それはクリックの後にのみ表示されます – SchoolBoy
2の答えとして、あなたは '!important'を使って属性を上書きする別のアニメーションを同時に追加することができます。ステップに設定します。これが行うことは、アニメーションが終了し、それらの属性が適用され、適用を停止し、ホバー効果が表示されるまでです。 – SchoolBoy
[this](https://jsfiddle.net/168b69dt/)1と3への回答を参照してください – SchoolBoy