【问题标题】:How do I show adsense on just only pages which are over 2400px height?如何仅在高度超过 2400 像素的页面上显示 adsense?
【发布时间】:2015-01-29 13:58:47
【问题描述】:

我想获取页面高度的信息,然后将 adsense 放在仅超过 2400 像素的页面上。如果您能给我任何线索,将不胜感激!

<script>
var height = $(document).height();
if (document > 2400 ) {
echo '<!--adsense code-->'; 
}
</script>

【问题讨论】:

    标签: jquery height document adsense


    【解决方案1】:

    您使用了错误的变量来比较高度值。你应该使用条件height&gt;2400 而不是document &gt; 2400

    var height = $(document).height();
    if (height > 2400 ) {
      echo '<!--adsense code-->'; 
    }
    

    【讨论】:

    • 非常感谢。但它仍然不起作用:'(如果我把这种adsense放在''下面可以吗?我很新手所以请原谅我...
    • @sayuri:很高兴它有帮助:)
    猜你喜欢
    • 2012-02-02
    • 1970-01-01
    • 2011-10-03
    • 1970-01-01
    • 2011-09-17
    • 1970-01-01
    • 2013-03-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多