From 8a2862a2007c8b9abe63007ddd5611e5ebd20bea Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 28 Feb 2013 16:47:04 +0100 Subject: [PATCH] Fetch on resize: initial fetch considers min/max-widths --- jquery.openx.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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! -- 2.20.1