[英]How can i resize <div> Element with flexigrid in <div>
html数据
<div id="flexdiv" class="resizable-ui">
<div> etc layer .. </div>
<table class='flexme1'>
...
</table>
</div>
var width = $(div).width(),
height = $(div).height()-100;
$('.flexme1').flexigrid({
width: width,
height: height,
resizable: false,
singleSelect: true});
$(div).resize(function() {
var width = $(div).width(),
height = $(div).height() -20;
$('.flexme1').flexigrid({height:height,width:width,striped:false});
});
它不起作用,我不知道这是什么问题,请帮助我! plz ..
所以我写了代码,您可以在其中调整div和table元素的大小:
<div id="flexdiv" class="resizable-ui" style="border: 1px solid">
<div> etc layer .. </div>
<table id="table1" class='flexme1' style="border: 2px dotted; width:200px; height:200px">
</table>
</div>
Javascript:
var div = document.getElementById("flexdiv");
var width = $(div).width(),
height = $(div).height();
alert("Div-OldHeight: "+ height);
alert("Div-OldWidth: "+ width);
var newHeight = "600px";
var newWidth = "400px";
div.style.height = newHeight;
div.style.width = newWidth;
alert("Div-NewHeight: "+ newHeight);
alert("Div-NewWidth: "+ newWidth);
var table = document.getElementById("table1");
width = $(table).width(),
height = $(table).height();
alert("Table-OldHeight: "+ height);
alert("Table-OldWidth: "+ width);
var newHeight = "100px";
var newWidth = "100px";
table.style.height = newHeight;
table.style.width = newWidth;
alert("Table-NewHeight: "+ newHeight);
alert("Table-NewWidth: "+ newWidth);
我已经在变量中放置了新的宽度和高度,您可以根据需要进行更改,希望您将获得基本的想法。 您还可以使表取决于div的大小,基本核心将保持与我提供的相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.