jQuery UI 在 TH 中可调整大小

发布于 2024-09-24 16:01:35 字数 262 浏览 1 评论 0原文

我正在尝试制作一个可调整大小的标题的表格。

在这里你可以看到一个例子,我首先尝试使用 div 调整大小,然后使用表格(效果很好)。然后我尝试使用另一个表的 th 来调整大小。什么也没发生。

http://jsfiddle.net/UVsKp/

可以使用 jquery UI 调整大小吗? <代码>

I'm trying to make a table with the th's of the header resizable.

Here you can see an example where I first try de resize with a div and then with a table (it works great). Then I try the resize with the th's of another table. Nothing happens.

http://jsfiddle.net/UVsKp/

Can the th's be resized using jquery UI??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

乖乖哒 2024-10-01 16:01:35

尝试使用:

html:

<table id="tblResize2">
    <thead>
        <tr>
            <th width="100px"><div>a</div></th>
            <th width="100px"><div>b</div></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
    </tbody>
</table>​

js:

$("#tblResize2 th div").resizable();

try with:

html:

<table id="tblResize2">
    <thead>
        <tr>
            <th width="100px"><div>a</div></th>
            <th width="100px"><div>b</div></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
    </tbody>
</table>​

js:

$("#tblResize2 th div").resizable();
岁月无声 2024-10-01 16:01:35

我做了一些小调整来强制调整大小期间/之后的大小:

resize:function(event,ui){
      ui.helper.parent().css('width',ui.size.width+'px');
}

I have done small tweak to force the size of the the during/after resize:

resize:function(event,ui){
      ui.helper.parent().css('width',ui.size.width+'px');
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文