var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); //以后使用layout-2.js 逃汰layout.js //平铺直接使用如下css即可,不必使用js. //水平平铺:style='left:0;right:0' //垂直平铺:style='top:0;bottom:0' $k.fn.layout = function (config) { var obj = function (selector, config) { this.selector = selector; this.config = $.extendEx({}, this.defConfig, config); } obj.prototype.defConfig = { }; obj.prototype.layout = function () { var _obj = this; var leftAttr = _obj.selector.attr('left'); var topAttr = _obj.selector.attr('top'); var rightAttr = _obj.selector.attr('right'); var bottomAttr = _obj.selector.attr('bottom'); var widthAttr = _obj.selector.attr('width'); var heightAttr = _obj.selector.attr('height'); var minWidthAttr = _obj.selector.attr('min-width'); var minHeightAttr = _obj.selector.attr('min-height'); var re = /\(this\)/g; if (widthAttr) { widthAttr = widthAttr.replace(re, "(_obj.selector)"); $(window).resize(function () { _obj.selector.css('width', eval(widthAttr)); }); _obj.selector.css('width', eval(widthAttr)); } if (heightAttr) { heightAttr = heightAttr.replace(re, "(_obj.selector)"); $(window).resize(function () { _obj.selector.css('height', eval(heightAttr)); }); _obj.selector.css('height', eval(heightAttr)); } if (minWidthAttr) { minWidthAttr = minWidthAttr.replace(re, "(_obj.selector)"); $(window).resize(function () { _obj.selector.css('min-width', eval(minWidthAttr)); }); _obj.selector.css('min-width', eval(minWidthAttr)); } if (minHeightAttr) { minHeightAttr = minHeightAttr.replace(re, "(_obj.selector)"); $(window).resize(function () { _obj.selector.css('min-height', eval(minHeightAttr)); }); _obj.selector.css('min-height', eval(minHeightAttr)); } if (leftAttr) { leftAttr = leftAttr.replace(re, "(_obj.selector)"); $(window).resize(function () { _obj.selector.css('left', eval(leftAttr)); }); _obj.selector.css('left', eval(leftAttr)); } if (topAttr) { topAttr = topAttr.replace(re, "(_obj.selector)"); $(window).resize(function () { _obj.selector.css('top', eval(topAttr)); }); _obj.selector.css('top', eval(topAttr)); } if (rightAttr) { rightAttr = rightAttr.replace(re, "(_obj.selector)"); $(window).resize(function () { _obj.selector.css('right', eval(rightAttr)); }); _obj.selector.css('right', eval(rightAttr)); } if (bottomAttr) { bottomAttr = bottomAttr.replace(re, "(_obj.selector)"); $(window).resize(function () { _obj.selector.css('bottom', eval(bottomAttr)); }); _obj.selector.css('bottom', eval(bottomAttr)); } } var _obj = new obj($(this.jo), config || {}); $(window).resize(function () { _obj.layout(); }); _obj.layout(); return _obj; } //实现自动调用. $(function () { $.each($('body').find('.kui-layout-2'), function (i, o) { $k(o).layout(); }); }); }