DIV를 숨기는 것은 오페라에서 제대로 작동하지 않습니다
-
06-07-2019 - |
문제
내 코드는 IE8, Firefox 및 Safari에서 훌륭하게 작동합니다. 그러나 오페라에서는 제대로 작동하지 않습니다. DIV가 숨겨져 있지만 DIV에 의해 점유 된 공간은 내 웹 페이지에 남아 있도록 남아 있습니다.
<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>
DIV가 차지하는 공간이 사라지는 공간은 무엇입니까?
감사
해결책
스타일을 시도 할 수 있습니다. Display 속성 :
숨다
document.getElementById ( 'YourELem'). Style.Display = 'None';
보여 주다
document.getElementById ( 'YourELem'). Style.Display = '';
편집하다: 이 답변에서 Pornel 의견을 Acocunt에 가져갔습니다
다른 팁
그것이 당신의 문제를 해결할 것인지 모르겠지만 당신은 다음을 시도 할 수 있습니다.
document.getElementById("xxx").display = "none";
대신에
document.getElementById("xxx").style.visibility = "hidden";
제휴하지 않습니다 StackOverflow