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"); $k.fn.split = function (config) { var obj = function (selector, config) { this.selector = selector; this.config = $.extendEx({}, this.defConfig, config); } obj.prototype.defConfig = { dragMode: $k.dragMode.h, onMoveEnd: function (_obj,distance) { var leftPart = $(_obj.selector.attr('split-left')); var rightPart = $(_obj.selector.attr('split-right')); var cssLeft = rightPart.css('left'); var left = cssLeft.substr(0, cssLeft.length - 2); left = parseFloat(left); left += distance; rightPart.css('left', left); var cssWidth = leftPart.css('width'); var width = cssWidth.substr(0, cssWidth.length - 2); width = parseFloat(width); width += distance; leftPart.css('width', width); } }; obj.prototype.split = function () { var _obj = this; if (_obj.selector.attr('split-direction') == 'v') { _obj.config.dragMode = $k.dragMode.v; } var len = $('.kui-sep-container').length; var sepContainer = null; if (len == 0) { sepContainer = $('
');//width:0:这样不会遮住内容 //$("body").prepend(sepContainer);//要插到最前面,如果放在最后面,会遮住前面的内容,导致内容只能看见不能操作. $("body").append(sepContainer); } else { sepContainer = $('.kui-sep-container'); } var target = _obj.selector[0]; var sep = $(target.outerHTML).appendTo(sepContainer); _obj.sep = sep; $(sep).removeAttr('id'); $(sep).css('cursor', 'ew-resize'); $(sep).css('left', $(target).offset().left); $(sep).css('top', $(target).offset().top); $(sep).css('width', $(target).css('width')); $(sep).css('height', $(target).css('height')); $k(sep).draggable({ dragMode:_obj.config.dragMode, onMoveStart: function (_drag, e) { //例如左右两栏拆分,左则是菜单,右侧是iframe,当鼠标移动到iframe这个区域时,$(document).mousemove、$(document).mouseup事件都不会发生,所以要创建一个shade层。 sepContainer.prepend('