JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id="detection">
adblock not detected
</div>
<br><br><br><br>
<div class="bottom-ads">
SOMETHING INSIDE AD ELEMENT (getting blocked)
</div>
SOMETHING OUTSIDE AD ELEMENT (visible)
</body>
JavaScript
setInterval(function(){
var adblock = isHidden(document.getElementsByClassName('bottom-ads'));
if (adblock)
document.getElementById('detection').innerHTML = "ADBLOCK DETECTED";
}, 1000);
function isHidden(el) {
var style = window.getComputedStyle(el[0], null);
return (style.display === 'none')
}