Hiding DIV does not work properly in Opera
-
06-07-2019 - |
Question
My code works great in IE8, Firefox and Safari. But it doesn't work properly in Opera. What happens is that the DIV is hidden but the space occupied by the DIV remains to appear in my web-page.
<div style=" z-index:-1;height :380; width:760; position:relative; text-align:center" id="new-add">
<object id="banner-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
width="769" height="382" top="0">
<param name="movie" value="exp.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
<embed src="exp.swf" wmode="transparent" quality="high" bgcolor="#ffffff" width="780" height="382"
name="mymoviename" align="" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>
</div>
<div id="fechar-link" style=" font-family: Verdana,Arial,Helvetica,sans-serif; font-style: normal;
font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none;
font-stretch: normal; text-decoration: none; text-align:center" >
<a href="#" onclick="
document.getElementById('new-add').style.height =0;
document.getElementById('banner-flash').style.height =0;
document.getElementById('fechar-link').style.height = 0;
document.getElementById('new-add').style.visibility ='hidden';
document.getElementById('banner-flash').style.visibility ='hidden';
document.getElementById('fechar-link').style.visibility ='hidden'; " >Close</a>
</div>
What do I need to do, so the space occupied by the DIV disappears?
Thanks
Solution
You might try the style.display property:
Hide
document.getElementById('YourElem').style.display = 'none';
Show
document.getElementById('YourElem').style.display = '';
EDIT: Took PorneL comment into acocunt in this answer
OTHER TIPS
I don't know if it will solve your problem, but you can try to use :
document.getElementById("xxx").display = "none";
instead of
document.getElementById("xxx").style.visibility = "hidden";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow