From 6f401624de884234f221a0ab97ba1a2fee8991aa Mon Sep 17 00:00:00 2001 From: Chris Hawkins Date: Fri, 25 Oct 2013 14:59:13 -0400 Subject: [PATCH] Added a json content type. Added the ability to pass arguments to the triggerCall function. --- jquery.bpopup.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jquery.bpopup.js b/jquery.bpopup.js index 71a5dbf..fc30abf 100644 --- a/jquery.bpopup.js +++ b/jquery.bpopup.js @@ -89,6 +89,14 @@ recenter($(this)); }).attr('src', o.loadUrl).hide().appendTo(o.contentContainer); break; + case ('json'): + open(); + $.getJSON(o.loadUrl, o.loadData, function( data ){ + var wrap = $('
').hide().appendTo(o.contentContainer); + triggerCall(o.loadCallback, [wrap, data]); + recenter(wrap); + }); + break; default: open(); $('
') @@ -290,8 +298,8 @@ return includeScroll ? vPos + d.scrollTop() : vPos; }; - function triggerCall(func) { - $.isFunction(func) && func.call($popup); + function triggerCall(func, args) { + $.isFunction(func) && func.apply($popup, args); }; function calPosition(){