HTML DOM 스타일 transitionProperty 속성은 HTML 문서에서 전환 효과를 위한 요소의 CSS 속성 이름을 반환하고 수정합니다.
구문
다음은 구문입니다 -
1. transitionProperty 반환
object.transitionProperty
2. transitionProperty 수정
object.transitionProperty = “value”
여기서 값은 -
일 수 있습니다.| 값 | 설명 |
|---|---|
| 초기 | 이 속성 값을 기본값으로 설정합니다. |
| 상속 | 상위 요소에서 이 속성 값을 상속합니다. |
| 모두 | 모든 속성에 전환 효과를 설정합니다. |
| 속성 | CSS 속성 목록을 나타냅니다. |
| 없음 | 속성을 선택하지 않습니다. |
HTML DOM 스타일 transitionProperty 속성의 예를 살펴보겠습니다.
예시
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
height: 100vh;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 40%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
margin: 1rem 0;
}
.circle {
height: 100px;
width: 100px;
background-color: #db133a;
}
.circle:hover {
height: 200px;
width: 200px;
border-radius: 50%;
transition: all 1s;
}
.show {
font-size: 1.2rem;
margin: 1rem 0;
}
</style>
<body>
<h1>DOM Style transitionProperty Property Demo</h1>
<div class='circle'></div>
<button onclick="set()" class="btn">Change TransitionProperty</button>
<div class="show">Now, hover on the square</div>
<script>
function set() {
document.querySelector('.circle').style.transitionProperty = "border-radius";
}
</script>
</body>
</html> 출력

"전환 속성 변경을 클릭합니다. " 버튼을 누른 다음 "빨간색 ” 사각형을 클릭하면 transitionProperty 효과를 볼 수 있습니다.
