I run a site at http://chasemccoy.net/, and on the desktop I serve an advertisement in the sidebar. This comes from some given JS code from the ad network.
The site loads a custom layout when viewed on an iPhone. I need to place that ad into the footer of the site when it's displayed on a mobile device. I am using media queries to change the mobile layout.
My initial solution was to add the JS to the footer, and just use display: none; on the desktop version. However, the JS will not load into the site twice. I basically news a way to prevent the JS from loading at all on the mobile version until it hits the footer code.
Any easy fix for this? I am not a JS wiz by any means. Thanks for your help.
Edit: Here is the JS for the ad:
<script async type="text/javascript" src="//cdn.yoggrt.com/yoggrt.js?zoneid=1353&serve=C6SD52Y&placement=chasemccoynet" id="_yoggrt_js"></script>
That is simply pasted into the place in the HTML where I would like it to appear. The only problem is that the browser will not load more than one instance of the code.
Edit: Here is an outline for the sidebar.
div id="sidebar">
<div class="gravatar">
<a href="http://chasemccoy.net/"><img alt src="avatar.png" class="avatar avatar-100 photo" height="100" width="100"></a>
</div>
<ul>
<li><a href="http://chasemccoy.net/start-here">Start Here</a></li>
<li><a href="http://chasemccoy.net/colophon">Colophon</a></li>
<li><a href="http://chasemccoy.net/archive">Archive</a></li>
<li><a href="http://chasemccoy.net/rss">RSS</a></li>
</ul>
<!-- Yoggrt.com Zone Code -->
<script async type="text/javascript" src="//cdn.yoggrt.com/yoggrt.js?zoneid=1353&serve=C6SD52Y&placement=chasemccoynet" id="_yoggrt_js"></script>
<!-- End Yoggrt.com Zone Code -->
</div> <!-- Sidebar -->