JavaScriptでトランジション効果の対象となるCSSプロパティを設定するにはどうすればよいですか?
例
<!DOCTYPE html>
<html>
<head>
<style>
#div1 {
position: relative;
margin: 10px;
height: 300px;
width: 400px;
padding: 20px;
border: 2px solid blue;
}
#div2 {
padding: 80px;
position: absolute;
border: 2px solid BLUE;
background-color: yellow;
transform: rotateY(45deg);
transition: all 3s;
}
#div2:hover {
background-color: orange;
width: 50px;
height: 50px;
padding: 100px;
border-radius: 50px;
}
</style>
</head>
<body>
<p>Hover over DIV2</p>
<button onclick = "display()"> Set </button>
<div id = "div1">DIV1
<div id="div2">DIV2</div>
</div>
<script>
function display() {
document.getElementById("div2").style.transitionProperty = "width,height";
}
</script>
</body>
</html> -
CSSを使用してアニメーションの塗りつぶしモードを設定する方法
CSSを使用したアニメーションの塗りつぶしモードを設定するには、 animation-fill-modeを使用します 財産。順方向、逆方向、両方向の値などがあります。 次のコードを実行して、アニメーションの塗りつぶしモードを設定できます。 例 <!DOCTYPE html> <html> <head> <style> div { &nbs
-
CSSで遷移効果を遅らせる方法
transition-delayを使用します CSSで遷移効果を遅らせるプロパティ。次のコードを実行して、移行の1秒の遅延を設定できます。 例 <!DOCTYPE html> <html> <head> <style> div { width: 150px;