Example1: {
css: "#example div { width: 80%; height: 80%; background: #AAA; }",
xml: `<VDividedBox id="example">
<div id='top'/>
<div id='bottom'/>
</VDividedBox>`
}
Example2: {
css: "#example div { width: 80%; height: 80%; background: #AAA; }",
xml: `<VDividedBox id="example" percent='30'>
<div id='top'/>
<div id='bottom'/>
</VDividedBox>`,
fun: function (sys, items, opts) {
sys.top.on("click", e => sys.example.percent = 50);
}
}
VDividedBox: {
xml: `<div id='hbox'>
<div id='top'/>
<div id='handle'/>
<div id='bottom'/>
</div>`
}
VDividedBox: {
xml: `<div id='hbox'>
<div id='top'/>
<div id='handle'/>
<div id='bottom'/>
</div>`,
map: {appendTo: "top" },
fun: function (sys, items, opts) {
sys.bottom.elem().appendChild(this.last().elem());
}
}
VDividedBox: {
css: `#hbox { position:relative; width:100%; height:100%; box-sizing: border-box; }
#top { top: 0; height: 30%; } #bottom { bottom: 0; height: calc(70% - 5px); }
#top,#bottom { left: 0; right: 0; position: absolute; }
#handle { height: 5px; width: 100%; position:absolute; left:0; top: 30%; z-index:11; cursor:row-resize; }`,
xml: `<div id='hbox'>
<div id='top'/>
<div id='handle'/>
<div id='bottom'/>
</div>`,
map: {appendTo: "top" },
fun: function (sys, items, opts) {
sys.bottom.elem().appendChild(this.last().elem());
}
}
VDividedBox: {
// 视图项同上
map: { format: {"int": "percent"}, appendTo: "top" },
fun: function (sys, items, opts) {
var percent = 50;
sys.handle.on("dragstart", function (e) {
sys.hbox.on("dragover", dragover);
});
sys.hbox.on("dragend", function (e) {
e.stopPropagation();
sys.hbox.off("dragover", dragover);
});
function dragover(e) {
e.preventDefault();
setPercent((e.pageY - sys.hbox.offset().top) / sys.hbox.height() * 100);
}
function setPercent(value) {
sys.handle.css("top", value + "%");
sys.top.css("height", value + "%");
sys.bottom.css("height", "calc(" + (100 - value) + "% - 5px)");
}
setPercent(opts.percent || percent);
sys.bottom.elem().appendChild(this.last().elem());
return Object.defineProperty({}, "percent", {get: () => {return percent}, set: setPercent});
}
}
Example3: {
css: `#example textarea { width: 80%; height: 80%; }`,
xml: `<VDividedBox id="example">
<textarea id='top'/>
<textarea id='bottom'/>
</VDividedBox>`
}
VDividedBox: {
css: "#hbox { position:relative; width:100%; height:100%; box-sizing: border-box; }\
#top { top: 0; height: 30%; } #bottom { bottom: 0; height: calc(70% - 5px); }\
#top,#bottom { left: 0; right: 0; position: absolute; }\
#handle { height: 5px; width: 100%; position:absolute; left:0; top: 30%; z-index:11; cursor:row-resize; }\
#mask { width: 100%; height: 100%; position: absolute; display: none; z-index: 10; }",
xml: "<div id='hbox'>\
<div id='top'/>\
<div id='handle' draggable='true'/>\
<div id='bottom'/>\
<div id='mask'/>\
</div>",
map: { format: {"int": "percent"}, appendTo: "top" },
fun: function (sys, items, opts) {
var percent = 50;
sys.handle.on("dragstart", function (e) {
sys.mask.show();
sys.hbox.on("dragover", dragover);
});
sys.hbox.on("dragend", function (e) {
sys.mask.hide();
e.stopPropagation();
sys.hbox.off("dragover", dragover);
});
function dragover(e) {
e.preventDefault();
setPercent((e.pageY - sys.hbox.offset().top) / sys.hbox.height() * 100);
}
function setPercent(value) {
sys.handle.css("top", value + "%");
sys.top.css("height", value + "%");
sys.bottom.css("height", "calc(" + (100 - value) + "% - 5px)");
}
setPercent(opts.percent || percent);
sys.bottom.elem().appendChild(this.last().elem());
return Object.defineProperty({}, "percent", {get: () => {return percent}, set: setPercent});
}
}
Example4: {
css: `#example div { width: 100%; height: 100%; }`,
xml: `<HDividedBox id='example'>
<VDividedBox percent='30'>
<div/><div/>
</VDividedBox>
<VDividedBox percent='30'>
<div/><div/>
</VDividedBox>
</HDividedBox>`
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有