자바스크립트 backfaceVisibility 사용 요소가 화면을 향하지 않는 동안 표시되어야 하는지 여부를 설정하는 속성입니다.
예시
다음 코드를 실행하여 backfaceVisibility를 구현하는 방법을 배울 수 있습니다. JavaScript의 속성 -
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 200px;
height: 300px;
background: blue;
color: black;
animation: mymove 2s infinite linear alternate;
}
@keyframes mymove {
to {transform: rotateY(180deg);}
}
</style>
</head>
<body>
<p>Check below to display backface</p>
<div id="box">
<h1>Demo</h1>
</div>
<input type="checkbox" onclick="display(this)" checked>backfaceVisibility Property
<script>
function display(x) {
if (x.checked === true) {
document.getElementById("box").style.backfaceVisibility = "visible";
} else {
document.getElementById("box").style.backfaceVisibility = "hidden";
}
}
</script>
</body>
</html>