[英]Change iframe content depending on screen size
Hello I have a problem I have an ad that can't be resized, the support said that I can use 2 ads 1 for mobile 1 for desktop so the ads are 720 x 90 and the other one is 300 x 100 i want it to change depending on scree size to switch between this two:您好,我有一个问题,我有一个无法调整大小的广告,支持人员说我可以使用 2 个广告 1 用于移动设备 1 用于桌面设备,因此广告为 720 x 90,另一个为 300 x 100 我想要它根据碎石大小在这两者之间切换:
<iframe border=0 frameborder=0 marginheight=0 marginwidth=0 width=736 height=98 scrolling=no allowtransparency=true src=zzzz></iframe>
and和
<iframe border=0 frameborder=0 marginheight=0 marginwidth=0 width=300 height=100 scrolling=no allowtransparency=true src=iiiiii></iframe>
if anyone can help me I will really appreciate it.如果有人可以帮助我,我将不胜感激。 Thanks.谢谢。
You can code both of these items and hide one via CSS depending on the browser size.您可以对这两项进行编码,并根据浏览器大小通过 CSS 隐藏一项。
<iframe class='lg' border=0 frameborder=0 marginheight=0 marginwidth=0 width=736 height=98 scrolling=no allowtransparency=true src=zzzz></iframe>
<iframe class='sm' border=0 frameborder=0 marginheight=0 marginwidth=0 width=300 height=100 scrolling=no allowtransparency=true src=iiiiii></iframe>
CSS : CSS :
@media (max-width: 719px) { //set max width to your preferred mobile width. I used 719 because your large banner is 720.
.lg {display:none;}
.sm {display:initial;}
}
@media (min-width: 720px) { //set min width to be larger than the css rule above.
.lg {display:initial;}
.sm {display:none;}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.