전환 효과가 시작되는 시간을 설정하려면 JavaScript transitionDelay 를 사용하십시오. 재산. 전환 효과가 JavaScript로 시작될 때 반환하는 방법을 배우기 위해 다음 코드를 실행할 수 있습니다 -
예시
<!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 5s;
}
#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.transitionTimingFunction = "ease-in";
document.getElementById("div2").style.transitionDelay = "1s";
}
</script>
</body>
</html>