Okay so this maybe no possible but i think it is, i'm completely new to this so what iv'e tried might obviously not work but i didn't know at the time. My sites mobile responsive with no separate webpage for mobile sites so putting the code into a page separately won't work either.
iv'e tried:
<style>
@media screen and (max-width: 720px) {
#div {
display:none;
}
}
</style>
<div id="div">
<script type="text/javascript">
var adfly_id = ID;
var popunder_frequency_delay = 0;
</script>
<script src="https://cdn.adf.ly/js/display.js"></script>
</div>
Which didn't work. Iv'e seen this code somewhere on here
if(screen.width < 720) {
// do any 720 width stuff here, or simply do nothing
return;
} else {
// do all your cool stuff here for larger screens
}
But i don't know how i would put the adfly code into it.
EDIT:
Thanks to those who replied, iv'e got it Praveen Kumar answer worked, while weirdly it still loads the ads on the desktop regardless of the resolution it works perfect on mobiles... Siguza i'll give yours ago so people know for future reference. and i'll edit again...
EDIT II:
For future reference, Siguza's method also works so if anyone else stumbles upon this then you can take your pic on who's to use. Also Praveen Kumar method works with shortest ads too for anyone that might use them instead of adfly below is what i use.
<script type="text/javascript">
if(screen.width < 720) {
var adfly_id = null;
var popunder_frequency_delay = null;
} else {
// do all your cool stuff here for larger screens
var adfly_id = ID;
var popunder_frequency_delay = 0;
}
</script>
<script src="https://cdn.adf.ly/js/display.js"></script>
<script type="text/javascript">
if(screen.width < 720) {
//screens bigger than 720
} else {
//shortest advertisement code
}
</script>