我有隐私政策。我添加了我的div的不透明度,但现在我不知道如何删除不透明度。我正在尝试删除该属性,但它无法正常工作。有人可以帮助我吗?这是一个非常迫切的要求。
<script type="text/javascript">
function show(id)
{
if(document.getElementById("wrapper")) //check the element exists and can be accessed
{
var ele = document.getElementById("wrapper");//get hold of the element
if(ele.style.visibility=="visible")//see if display property is set to none
{
}
else
{
ele.style.visibility="visible";
document.getElementById('LOGIN').style.opacity = 0.4;
}
}
}
function hide(id)
{
if(document.getElementById("wrapper"))//check the element exists and can be accessed
{
var ele = document.getElementById("wrapper");//get hold of the element
if(ele.style.visibility=="visible")//see if display property is set to none
{
ele.style.visibility="hidden";
}
else
{
}
}
}
</script>
<style>
#wrapper {
position:absolute;
z-index:1;
top:11%; bottom:5%; left:4%;right:15%;
width:87%;
height:75%;
font-size:15pt;
border:5px solid orange;
border-radius:25px;
overflow:auto;
visibility:hidden;
background-color:#ffffff;
}
#LOGIN.faded {
opacity: 0.5;
}
</style>
</head>
<body >
<div id="LOGIN" align="center">
<table width="100%">
<tr>
<td>
<input type="image" src="../images/header-sign-up.png" style="width:100%" alt=""/>
</td>
</tr>
</table>
<div align="center">
<a href="#" onclick ="show('showhide');">View privacy policy</a>
</div>
</div>
<div id="wrapper">
<div id="scroller" >
<div id="popupContact" >
<a href="#" onclick ="hide('showhide');">Close Window</a><br/>
<p>
biler Privacy Policy
Please feel free to contact us with any comments, questions, complaints or suggestions you might have regarding the information practices described in this statement. You may send us an e-mail at
</p>
</div>
</div>
</div>
</body>
</html>
答案 0 :(得分:3)
尝试使用不透明度,或显示...
document.getElementById('varContent').style.opacity = 0;
document.getElementById('varContent').style.opacity = 1;
或
document.getElementById('varContent').style.display = 'none';
document.getElementById('varContent').style.display = 'block';
答案 1 :(得分:1)
您必须设置opacity
值1
。
答案 2 :(得分:0)
基于Web工具包的浏览器设置不透明度为1将(不必要地)减慢显示速度(尤其是在背景图像上滚动不透明度为1的内容时)
更好地删除属性(如果您确定它可用(IE 9或更高版本),则使用“removeProperty”方法:
element.style.removeProperty("opacity")
或更兼容:
element.style.opacity = ""