簡體   English   中英

如何在小屏幕上隱藏廣告

[英]How to hide ads on small screens

我希望在網站的移動版上隱藏一個廣告。 我想這樣做。

<script>
    if(screen.width > 900){
        "here call the script that is ad"
    }
</script>

我的廣告腳本也是js腳本,但是它不在我的域中,因此我無法使用Ajax調用來調用它。 任何幫助表示贊賞。 我的廣告代碼看起來像

<script src='//url..'> </script> 

您為什么不只使用CSS和媒體查詢來做到這一點?

包裝在DIV中添加的內容(例如<div id="ad_1">...[link to your ad or content]...</div> )並添加到樣式表中

@media only screen and (max-width: 900px) {
  #ad_1 { display: none; }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM