Display Code on Mobile Only

Posted in: Newspaper
Post count: 108

Hello

I need help, I put this code above </body>:


<div class="sticky-ad" id="sticky-ad">
<!-- Place adsense code below -->

<button class="sticky-ad-close-button" onclick="document.getElementById('sticky-ad').style.display='none';" aria-label="Close this ad"></button>
</div>

<script>
//<![CDATA[
window.addEventListener("scroll",function(){
var target = document.getElementById('sticky-ad');
if(window.pageYOffset > 300){
target.style.bottom = "0";
}
},false);
//]]>
</script>

The code is work, but show in all devices.

I want all of this code display on mobile only, I already try a few things, but doesn’t work.

Thank you

  • This topic was modified 7 years by McDohl.
  • This topic was modified 7 years by McDohl.
Post count: 108

I already solved this issue.

Thanks

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.