Tuesday, May 10, 2016

How to load media.net Ads in a non-blocking mode programatically

Step #1 Add your ad code in a div at the end of your page

<div id="nm_ads_temp" style="width:300px;height:250px;">
<script id="mNCC" language="javascript"> medianet_width='300'; medianet_height= '250'; medianet_crid='YOUR_ID'; </script>
<script id="mNSC" src="http://contextual.media.net/nmedianet.js?cid=YOUR_ID_2" language="javascript"></script>
</div>

Step #2 Move that div to another pre-specified location in the page

setTimeout(function()
{
$("#nm_ads_temp").attr("style","position:absolute;top:"+$("#mn_ads").offset().top+";left:"+$("#mn_ads").offset().left+";")
},5000);
<!-- your target div up somewhere in the page -->
<div id="mn_ads" style="position:relative;width:300px;height:250px;">

</div>