|
@@ -30,6 +30,7 @@
|
|
|
$.divResizer = function(setting) {
|
|
$.divResizer = function(setting) {
|
|
|
const obj = $(setting.select);
|
|
const obj = $(setting.select);
|
|
|
let drag, mouseMoveCount, startPos, orgSize1, orgSize2, newSize1, newSize2, objSize;
|
|
let drag, mouseMoveCount, startPos, orgSize1, orgSize2, newSize1, newSize2, objSize;
|
|
|
|
|
+ const rType = obj.attr('r-type'), aType = obj.attr('a-type');
|
|
|
// if (obj.attr('r-type') === 'height') {
|
|
// if (obj.attr('r-type') === 'height') {
|
|
|
// obj.css('width', '100%').css('height', '1%').css('resize', 'vertical').css('cursor', 's-resize').css('float', 'top');
|
|
// obj.css('width', '100%').css('height', '1%').css('resize', 'vertical').css('cursor', 's-resize').css('float', 'top');
|
|
|
// } else {
|
|
// } else {
|
|
@@ -38,7 +39,6 @@
|
|
|
// 根据localStorage初始化
|
|
// 根据localStorage初始化
|
|
|
|
|
|
|
|
const refreshDivSize = function() {
|
|
const refreshDivSize = function() {
|
|
|
- const rType = obj.attr('r-type'), aType = obj.attr('a-type');
|
|
|
|
|
const div1 = $(obj.attr('div1')), div2 = $(obj.attr('div2'));
|
|
const div1 = $(obj.attr('div1')), div2 = $(obj.attr('div2'));
|
|
|
const parent = div1.parent();
|
|
const parent = div1.parent();
|
|
|
if (aType !== 'percent' && parent[rType]() > 0) {
|
|
if (aType !== 'percent' && parent[rType]() > 0) {
|
|
@@ -53,9 +53,35 @@
|
|
|
}
|
|
}
|
|
|
if (setting.callback) { setting.callback(); }
|
|
if (setting.callback) { setting.callback(); }
|
|
|
};
|
|
};
|
|
|
|
|
+ const showSprPart = function (show) {
|
|
|
|
|
+ const rParent = obj.attr('rParent');
|
|
|
|
|
+ const div1 = $(obj.attr('div1')), div2 = $(obj.attr('div2'));
|
|
|
|
|
+ const parent = div1.parent();
|
|
|
|
|
+ if (show) {
|
|
|
|
|
+ if (rParent === 'div1') {
|
|
|
|
|
+ div1.show();
|
|
|
|
|
+ autoFlashHeight();
|
|
|
|
|
+ div2[rType](orgSize2);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ div2.show();
|
|
|
|
|
+ autoFlashHeight();
|
|
|
|
|
+ div1[rType](orgSize1);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (rParent === 'div1') {
|
|
|
|
|
+ div1.hide();
|
|
|
|
|
+ autoFlashHeight();
|
|
|
|
|
+ div2[rType](parent[rType]());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ div2.hide();
|
|
|
|
|
+ autoFlashHeight();
|
|
|
|
|
+ div1[rType](parent[rType]());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
if (obj.attr('store-id')) {
|
|
if (obj.attr('store-id')) {
|
|
|
- const rType = obj.attr('r-type'), version = obj.attr('store-version') ? ('-'+obj.attr('store-version')) : '' ;
|
|
|
|
|
|
|
+ const version = obj.attr('store-version') ? ('-'+obj.attr('store-version')) : '' ;
|
|
|
const objSize1 = getLocalCache('v-resize-1-' + obj.attr('store-id') + version);
|
|
const objSize1 = getLocalCache('v-resize-1-' + obj.attr('store-id') + version);
|
|
|
if (objSize1) {
|
|
if (objSize1) {
|
|
|
$(obj.attr('div1')).css(rType, objSize1);
|
|
$(obj.attr('div1')).css(rType, objSize1);
|
|
@@ -66,10 +92,12 @@
|
|
|
}
|
|
}
|
|
|
refreshDivSize();
|
|
refreshDivSize();
|
|
|
if (setting.callback) { setting.callback(); }
|
|
if (setting.callback) { setting.callback(); }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ orgSize1 = $($(this).attr('div1'))[rType]();
|
|
|
|
|
+ orgSize2 = $($(this).attr('div2'))[rType]();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
obj.mousedown(function (e) {
|
|
obj.mousedown(function (e) {
|
|
|
- const rType = obj.attr('r-type');
|
|
|
|
|
mouseMoveCount = 0;
|
|
mouseMoveCount = 0;
|
|
|
drag = true;
|
|
drag = true;
|
|
|
startPos = rType === 'height' ? e.clientY : e.clientX;
|
|
startPos = rType === 'height' ? e.clientY : e.clientX;
|
|
@@ -84,7 +112,6 @@
|
|
|
});
|
|
});
|
|
|
$('body').mousemove(function (e) {
|
|
$('body').mousemove(function (e) {
|
|
|
if (drag) {
|
|
if (drag) {
|
|
|
- const rType = obj.attr('r-type'), aType = obj.attr('a-type');
|
|
|
|
|
const moveSize = rType === 'height' ? e.clientY - startPos : e.clientX - startPos;
|
|
const moveSize = rType === 'height' ? e.clientY - startPos : e.clientX - startPos;
|
|
|
//实时刷新页面
|
|
//实时刷新页面
|
|
|
mouseMoveCount += moveSize;
|
|
mouseMoveCount += moveSize;
|
|
@@ -118,7 +145,6 @@
|
|
|
$('body').mouseup(function () {
|
|
$('body').mouseup(function () {
|
|
|
if (drag) {
|
|
if (drag) {
|
|
|
drag = false;
|
|
drag = false;
|
|
|
- const rType = obj.attr('r-type'), aType = obj.attr('a-type');
|
|
|
|
|
const localId = obj.attr('store-id'), version = obj.attr('store-version') ? ('-'+obj.attr('store-version')) : '' ;
|
|
const localId = obj.attr('store-id'), version = obj.attr('store-version') ? ('-'+obj.attr('store-version')) : '' ;
|
|
|
const div1 = $(obj.attr('div1')), div2 = $(obj.attr('div2'));
|
|
const div1 = $(obj.attr('div1')), div2 = $(obj.attr('div2'));
|
|
|
if (aType === 'percent') {
|
|
if (aType === 'percent') {
|
|
@@ -131,6 +157,6 @@
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- return { refreshDivSize };
|
|
|
|
|
|
|
+ return { refreshDivSize, showSprPart };
|
|
|
}
|
|
}
|
|
|
})(jQuery);
|
|
})(jQuery);
|