设置在不使用JavaScript面对屏幕时是否应该显示元素?
使用JavaScriptbackfaceVisibility属性设置不面对屏幕时元素是否应可见。
示例
您可以尝试运行以下代码来学习如何在JavaScript中实现backfaceVisibility属性-
<!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>热门推荐
10 对患者生日祝福语简短
11 结婚祝福语简短装备
12 周岁祝福语学生文案简短
13 订婚领证祝福语简短精辟
14 导师获奖祝福语大全简短
15 新婚购房祝福语简短精辟
16 牛年祝福语简短的爱人
17 送芒果的祝福语简短
18 送给学长毕业祝福语简短