私はタイルのようなものやnetflixのことをやろうとしています。私は、マウスを動かすと成長し、マウスが離れるとサイズが小さくなるようにしようとしている箱があります。だから私はこれを持っています。マウスのCSSアニメーションを残す
.nav {
position: relative;
top: 25%;
width: 100%;
color: black;
text-align: center;
}
.nav a {
color: white;
text-decoration: none;
}
.link {
font-size: 24px;
width: 100%;
height: 25%;
background: linear-gradient(135deg, #87e0fd 0%, #53cbf1 40%, #05abe0 100%);
display: inline;
padding-right: 12.5%;
padding-left: 12.5%;
padding-bottom: 6.25%;
padding-top: 6.25%;
box-shadow: 0px 0px 10px 5px grey;
animation-name: downsize;
animation-duration: .5s;
animation-iteration-count: 1;
animation-direction: alternate;
animation-timing-function: ease-in-out;
}
.link:hover {
animation-name: resize;
animation-duration: .5s;
animation-iteration-count: 1;
animation-direction: alternate;
animation-timing-function: ease-in-out;
font-size: 32px;
padding-right: 14.5%;
padding-left: 14.5%;
padding-bottom: 8.25%;
padding-top: 8.25%;
}
<div class="nav">
<a href="/public/MM/EnterUp">
<div class="link" style="margin-right: 15px;">
Enter Up
</div>
</a>
<a href="/public/MM/EnterUp">
<div class="link" style="margin-right: 15px;">
View Ups
</div>
</a>
</div>
私はそれは、マウスのホバー後に減らすために取得するCSS-Tricks を使用。私の問題は、CSS-Tricksとは異なり、ページを読み込むときにマウスが去った直後にアニメーションを実行したくないということです。誰にでも解決策がありますか?助けてくれてありがとう!
このアニメーションを作成するには、mouseoutイベントがCSSに存在しないため、Jimまたはpure JSを使用する必要があります。アニメーションを持つ2つのクラスを作成し、マウスオーバーでこれらのクラスを削除し、ズームアニメーションを保持するクラスを追加するonmouseout remove scaleクラスを追加し、回転を保持するクラスを追加します。 –
悲しい一日、あなたは彼らがこれのために2つの別のセレクターを作ったと思うでしょう。どのようにCSSトリックはそれをしますか?私は彼らのjavascriptを使用するとは思わないが、簡単に間違っている可能性があります。 https://css-tricks.com/examples/DifferentTransitionsOnOff/ – MisterQuacker
mouseLeave後に必要なアニメーションのタイプは? –