如何使广告响应

时间:2016-10-07 11:54:32

标签: html css

这是我的网站:http://thelolinternet.com/

正如您所看到的,广告的上限大小为<security:http> <security:expression-handler ref="yourCustomExpressionHandler"/> </security:http> 但是当您在移动设备上打开网站时(尝试更改浏览器宽度),广告的尺寸不会减少。解决办法是什么?

我不知道如何让它变得敏感。

这是代码:

height="90" width="728"

以下是百分比建议后的代码:

<div  data-WRID="WRID-147582892358590272" data-widgetType="Push Content"  data-class="affiliateAdsByFlipkart" height="90" width="728"></div>
<script async src="//affiliate.flipkart.com/affiliate/widgets/FKAffiliateWidgets.js"></script>

1 个答案:

答案 0 :(得分:0)

你可以这样做,在你的开发环境中测试它,因为它在小提琴中不起作用

device_width = window.outerWidth;
ad = document.getElementById('ad');

if (device_width == '740')
{
  ad.style.width = '700'
}
else if(device_width == '480')
{
  ad.style.width = '400'
}
<div id="ad">
  <h2>THIS IS AN AD</h2>
</div>