My app is built using a 2-column design, with the right 300-pixel column being used to show one Adsense ad unit.
Since some pages are taller, I am wondering if there's a way to have jQuery determine the height of my #main_wrapper
and show an additional ad unit if it exceeds a certain size in pixels. Sort of like this:
// ad unit #1 shown here by default in all pages
<script>
$(document).ready(function(){
if ($('#main_wrapper').height() > 660) {
//show add unit #2
}
});
</script>
My issue is with how to deal with wrapping the ad unit code with the jQuery/JS condition above. A typical ad unit is:
<script type="text/javascript"><!--
google_ad_client = "ca-pub-123123123123";
/* Sidebar 300 Middle */
google_ad_slot = "123123123";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
How would I insert that inside the jQuery above?