PageRenderTime 24ms CodeModel.GetById 21ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/projekty/all_elements/files/resources/lib/jquery/plugins/bgiframe_2.1.2/jquery.bgiframe.js

https://bitbucket.org/baniol/mobilang
JavaScript | 39 lines | 28 code | 5 blank | 6 comment | 3 complexity | e048a77b314095a4cb774cdac380eb8c MD5 | raw file
 1/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 2 * Licensed under the MIT License (LICENSE.txt).
 3 *
 4 * Version 2.1.2
 5 */
 6
 7(function($){
 8
 9$.fn.bgiframe = ($.browser.msie && /msie 6\.0/i.test(navigator.userAgent) ? function(s) {
10    s = $.extend({
11        top     : 'auto', // auto == .currentStyle.borderTopWidth
12        left    : 'auto', // auto == .currentStyle.borderLeftWidth
13        width   : 'auto', // auto == offsetWidth
14        height  : 'auto', // auto == offsetHeight
15        opacity : true,
16        src     : 'javascript:false;'
17    }, s);
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))+';'+
25                '"/>';
26    return this.each(function() {
27        if ( $(this).children('iframe.bgiframe').length === 0 )
28            this.insertBefore( document.createElement(html), this.firstChild );
29    });
30} : function() { return this; });
31
32// old alias
33$.fn.bgIframe = $.fn.bgiframe;
34
35function prop(n) {
36    return n && n.constructor === Number ? n + 'px' : n;
37}
38
39})(jQuery);