In my code, I have a division with the class siteads
where I insert js-adbanners
. I also have another division with the id adblockmessage
.
<div class="siteads"><!-- js-code goes here --></div>
<div id="adblockmessage"><!-- adblock message goes here --></div>
The task at hand seems straightforward: check the height
of .siteads
and if it is 0px
, display #adblockmessage
as a block (or toggle its visibility).
This is the solution I came up with:
function blockAdblockUser() {
if ($('.siteads').height() == 0) {
$('#adblockmessage').show();
else
$('#adblockmessage').hide();
}
}
$(document).ready(function(){
blockAdblockUser();
});
Any jQuery experts out there who can quickly solve this? Much appreciated in advance!