1
我有两个ID为sample1 & sample2的表。 sample1包含<th class="header">
,sample2包含<td class="desc">
。我想要做的就是当我在sample1中调整<th>
的大小时,它也应该自动调整样本2中的<td>
以相同的同步。我正在使用jQuery resizeable()
方法,但我没有得到它。如何在鼠标拖动事件中为其中一列调整两个表格的列大小?
请帮助。
这里是参考代码:
<script type="text/javascript" charset="utf-8">
$(function() {
$("#sample1 .header").resizable();
$("#sample2 .desc").resizable();
});
</script>
</head>
<body>
<div class="center" >
<table id="sample1" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<th class="header">header</th><th class="header">header</th>
</tr>
</table>
<table id="sample2" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="desc">cell</td>
<td class="desc">cell</td>
</tr>
<tr>
<td class="desc">cell</td>
<td class="desc">cell</td>
</tr>
<tr>
<td class="desc">cell</td>
<td class="desc">cell</td>
</tr>
</table>
</div>
</body>
</html>
我有两个
回答
这应做到:
也有看API jQuery的调整大小here
更新:
你可以做这样的事情。
来源
2012-05-04 08:05:06 Falle1234
谢谢Falle1234,但我尝试过我们的代码,但它没有在同一方向上调整大小。它在相反的方向碰撞。请在你的机器上试试这个代码,看看。 – surajR
我认为你看到的是由两个表 – Falle1234
上的100%宽度造成的,那么我应该怎么做?我应该删除宽度属性?请建议 – surajR
还没有尝试,但在documentation基地,它应该是:
编辑: 这是你想要的吗?
来源
2012-05-04 08:05:27 fankt
嗨@ evanc3这不工作。它只是调整
相关问题