Dùng thuộc tính backfaceVisibility của JavaScript để đặt xem phần tử có hiển thị khi không đối diện màn hình.
Ví dụ
Bạn có thể chạy mã sau để học cách triển khai thuộc tính backfaceVisibility trong 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>Kiểm tra dưới để hiển thị backface</p> <div id="box"> <h1>Demo</h1> </div> <input type="checkbox" onclick="display(this)" checked>Thuộc tính backfaceVisibility <script> function display(x) { if (x.checked === true) { document.getElementById("box").style.backfaceVisibility = "visible"; } else { document.getElementById("box").style.backfaceVisibility = "hidden"; } } </script> </body> </html>