如何在包含Google Adsense广告时隐藏div? [英] How to hide div when containing a Google adsense advert?
本文介绍了如何在包含Google Adsense广告时隐藏div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个div,其中包含adsense广告。但是,如果一个类存在,我想删除div。
I have a div that contains an adsense ad. However I want to remove the div if a class is present.
<div id=bannerad>
... adsense ad ...
</div>
$(document).ready(function(){
if ($('.back').is(":visible") == true)
$( "#bannerad" ).remove();
});
这是最好的方法。将通过 .remove()
使用jQuery通过css使用显示:无
反对googles t + c 。
What is the best way to achieve this. Would it be using jQuery via .remove()
as using a display:none
via css is against googles t+c's.
感谢,
推荐答案
$('.back:visible').remove();
使用 CSS
:
Using CSS
display:none
you can't remove it, you just hide it.
如果您使用 $('。 :visible')。hide()
/ $('back:visible')css('display','none');
您可以使用 $('。back:visible')。show()
但通过 .remove()
,您将无法再次显示。
you can using $('.back:visible').show()
to show it. But via .remove()
, you can't show it again.
这篇关于如何在包含Google Adsense广告时隐藏div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文