From: Kai Moritz Date: Thu, 28 Feb 2013 15:47:04 +0000 (+0100) Subject: Fetch on resize: initial fetch considers min/max-widths X-Git-Tag: 0.2.0~3 X-Git-Url: http://juplo.de/gitweb/?p=openx;a=commitdiff_plain;h=8a2862a2007c8b9abe63007ddd5611e5ebd20bea Fetch on resize: initial fetch considers min/max-widths --- diff --git a/jquery.openx.js b/jquery.openx.js index a2343bb..a9827af 100644 --- a/jquery.openx.js +++ b/jquery.openx.js @@ -31,6 +31,7 @@ slots = {}, min_width = {}, max_width = {}, + width, queue = [], output = []; @@ -190,6 +191,9 @@ }); } + /** Set initial window-width */ + width = $(document).width(); + /** Fetch the JavaScript for Flash and schedule the initial fetch */ $.getScript(domain + settings.delivery + '/' + settings.fl, fetch_ads); @@ -202,8 +206,10 @@ /** Order banners for all zones that were found on the page */ src += '?zones='; for(id in slots) { - queue.push(id); - src += escape(id + '=' + OA_zones[slots[id].id] + "|"); + if (width >= min_width[id] && width <= max_width[id]) { + queue.push(id); + src += escape(id + '=' + OA_zones[slots[id].id] + "|"); + } } src += '&nz=1'; // << We want to fetch named zones!