iframe을 숨길 수 있는 방법이 있나요?
iframe으로 웹사이트나 동영상을 불러와서 숨기고 싶은데
숨길 수 있는 방법이 있나요? 어떻게 숨기면 되나요?
55글자 더 채워주세요.
2개의 답변이 있어요!
<iframe src="http://example.com" scrolling="no" ></iframe>
scrolling="no" 를 작성하시면 스크롤을 숨기실 수 있습니다.
<iframe src="http://example.com" style="visibility:hidden;" ></iframe>
visibility를 hidden으로 주면 보이지는 않지만 아이프레임이 있는 공간을 차지합니다.
<iframe src="http://example.com" style="display:none;" ></iframe>
display를 none으로 주면 보이지도 않고 공간도 차지하지 않습니다.
"iframe으로 웹사이트나 동영상을 불러와서 숨기고 싶은데
숨길 수 있는 방법이 있나요? 어떻게 숨기면 되나요? "
>> 일단 굳이 불러온 웹사이트나 동영상을 숨기시는 이유를 설명해주셔야 도움드리기 좋을것같습니다.
다만 불러온 사이트를 숨기고싶으시다면 가장 간단하게는 그냥 해당 iframe 을 통째로 숨기시면 됩니다.
document.querySelector("iframeClassname").style.display = "none"
반대로 다시 보이고 싶으시면
document.querySelector("iframeClassname").style.display = "block"
하시면 됩니다.