diff --git a/jquery.interstitial.css b/jquery.interstitial.css index 19d01d8..9d3143f 100644 --- a/jquery.interstitial.css +++ b/jquery.interstitial.css @@ -31,6 +31,17 @@ z-index: 1000001; } +#iframe +{ + width: 100%; + height: 100%; + border: none; + outline: none; + position: absolute; + top: 0; + left: 0; +} + /*--Making IE6 Understand Fixed Positioning--*/ *html #fade { position: absolute; diff --git a/jquery.interstitial.js b/jquery.interstitial.js index f745a91..cff342c 100644 --- a/jquery.interstitial.js +++ b/jquery.interstitial.js @@ -27,6 +27,7 @@ 'width' : 600, 'height' : 400, 'opacity' : 70, + 'isiFrame' : false, 'id' : 'popupBlock', 'onInterstitialClose' : function(){} }; @@ -39,24 +40,35 @@ //Fade in the Popup $('body').append('
'); - $('#' + settings.id).load(settings.url, function() { - $('#' + settings.id).css({'width' : Number(settings.width), 'height' : Number(settings.height)}).fadeIn(); - }); - - //Define margin for center alignment (vertical + horizontal) - var popMargTop = settings.height / 2; - var popMargLeft = settings.width / 2; - - //Apply Margin to Popup - $('#' + settings.id).css({ - 'margin-top' : -popMargTop, - 'margin-left' : -popMargLeft - }); + if (settings.isiFrame) { + + $(''); // Create an iframe element + $('', { + name: 'frame', + id: 'iframe', + src: settings.url, + }).appendTo('#' + settings.id); + $('#' + settings.id).fadeIn(); + } else { + $('#' + settings.id).load(settings.url, function () { + $('#' + settings.id).css({'width': Number(settings.width), 'height': Number(settings.height)}).fadeIn(); + }); + + //Define margin for center alignment (vertical + horizontal) + var popMargTop = window.height / 2; + var popMargLeft = window.width / 2; + + //Apply Margin to Popup + $('#' + settings.id).css({ + 'margin-top': -popMargTop, + 'margin-left': -popMargLeft + }); + } - //On click of the fade, close the popup and fade - $('#fade').live('click', function() { + //On click of the fade, close the popup and fade + $('#fade').live('click', function() { $().interstitial('close', settings); - }); + }); },