diff options
author | Nina Vyedin <nina.vyedin@gmail.com> | 2013-03-05 03:55:46 +0400 |
---|---|---|
committer | Nina Vyedin <nina.vyedin@gmail.com> | 2013-03-05 07:57:22 +0400 |
commit | 14b689586b92b860823aea350e402dab548a448d (patch) | |
tree | cb95669fc2ba2f208465dc362e3f58809c5451b9 /webdoc/plugins | |
parent | 55a628b1932335a3f54d3d1f5d82741fc10a0532 (diff) |
[webdoc] add the iframe plugin
Diffstat (limited to 'webdoc/plugins')
-rw-r--r-- | webdoc/plugins/iframe-plugin/iframe.js | 3 | ||||
-rw-r--r-- | webdoc/plugins/iframe-plugin/jquery.iframe-auto-height-plugin.1.9.0.min.js | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/webdoc/plugins/iframe-plugin/iframe.js b/webdoc/plugins/iframe-plugin/iframe.js new file mode 100644 index 00000000..7074b03c --- /dev/null +++ b/webdoc/plugins/iframe-plugin/iframe.js @@ -0,0 +1,3 @@ + $(document).ready(function () { + $('iframe').iframeAutoHeight({debug: true}); + }); diff --git a/webdoc/plugins/iframe-plugin/jquery.iframe-auto-height-plugin.1.9.0.min.js b/webdoc/plugins/iframe-plugin/jquery.iframe-auto-height-plugin.1.9.0.min.js new file mode 100644 index 00000000..7aa2143f --- /dev/null +++ b/webdoc/plugins/iframe-plugin/jquery.iframe-auto-height-plugin.1.9.0.min.js @@ -0,0 +1,7 @@ +/* + Plugin: iframe autoheight jQuery Plugin + Version: 1.9.0 + Description: when the page loads set the height of an iframe based on the height of its contents + see README: http://github.com/house9/jquery-iframe-auto-height +*/ +(function(a){a.fn.iframeAutoHeight=function(b){function d(a){c.debug&&c.debug===!0&&window.console&&console.log(a)}function e(b,c){d("Diagnostics from '"+c+"'");try{d(" "+a(b,window.top.document).contents().find("body")[0].scrollHeight+" for ...find('body')[0].scrollHeight"),d(" "+a(b.contentWindow.document).height()+" for ...contentWindow.document).height()"),d(" "+a(b.contentWindow.document.body).height()+" for ...contentWindow.document.body).height()")}catch(e){d(" unable to check in this state")}d("End diagnostics -> results vary by browser and when diagnostics are requested")}var c=a.extend({heightOffset:0,minHeight:0,callback:function(a){},animate:!1,debug:!1,diagnostics:!1,resetToMinHeight:!1,triggerFunctions:[],heightCalculationOverrides:[]},b);return d(c),this.each(function(){function g(a){var c=null;return jQuery.each(b,function(b,d){if(a[d])return c=f[d],!1}),c===null&&(c=f["default"]),c}function i(b){c.diagnostics&&e(b,"resizeHeight"),c.resetToMinHeight&&c.resetToMinHeight===!0&&(b.style.height=c.minHeight+"px");var f=a(b,window.top.document).contents().find("body"),h=g(a.browser),i=h(b,f,c,a.browser);d(i),i<c.minHeight&&(d("new height is less than minHeight"),i=c.minHeight+c.heightOffset),d("New Height: "+i),c.animate?a(b).animate({height:i+"px"},{duration:500}):b.style.height=i+"px",c.callback.apply(a(b),[{newFrameHeight:i}])}var b=["webkit","mozilla","msie","opera"],f=[];f["default"]=function(a,b,c,d){return b[0].scrollHeight+c.heightOffset},jQuery.each(b,function(a,b){f[b]=f["default"]}),jQuery.each(c.heightCalculationOverrides,function(a,b){f[b.browser]=b.calculation});var h=0;d(this),c.diagnostics&&e(this,"each iframe");if(c.triggerFunctions.length>0){d(c.triggerFunctions.length+" trigger Functions");for(var j=0;j<c.triggerFunctions.length;j++)c.triggerFunctions[j](i,this)}if(a.browser.webkit||a.browser.opera){d("browser is webkit or opera"),a(this).load(function(){var a=0,b=this,e=function(){i(b)};h===0?a=500:b.style.height=c.minHeight+"px",d("load delay: "+a),setTimeout(e,a),h++});var k=a(this).attr("src");a(this).attr("src",""),a(this).attr("src",k)}else a(this).load(function(){i(this)})})}})(jQuery); |