1 /*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
2 * Licensed under the MIT License (LICENSE.txt).
9 $.fn
.bgiframe
= ($.browser
.msie
&& /msie 6\.0/i.test(navigator
.userAgent
) ? function(s
) {
11 top
: 'auto', // auto == .currentStyle.borderTopWidth
12 left
: 'auto', // auto == .currentStyle.borderLeftWidth
13 width
: 'auto', // auto == offsetWidth
14 height
: 'auto', // auto == offsetHeight
16 src
: 'javascript:false;'
18 var html
= '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s
.src
+'"'+
19 'style="display:block;position:absolute;z-index:-1;'+
20 (s
.opacity
!== false?'filter:Alpha(Opacity=\'0\');':'')+
21 'top:'+(s
.top
=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s
.top
))+';'+
22 'left:'+(s
.left
=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s
.left
))+';'+
23 'width:'+(s
.width
=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s
.width
))+';'+
24 'height:'+(s
.height
=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s
.height
))+';'+
26 return this.each(function() {
27 if ( $(this).children('iframe.bgiframe').length
=== 0 )
28 this.insertBefore( document
.createElement(html
), this.firstChild
);
30 } : function() { return this; });
33 $.fn
.bgIframe
= $.fn
.bgiframe
;
36 return n
&& n
.constructor === Number
? n
+ 'px' : n
;