【问题标题】:Want to auto-resize jQuery UI.Layout's div width and height when resize the container of them using JQuery UI resizable!想要在使用 JQuery UI resizable 调整容器大小时自动调整 jQuery UI.Layout 的 div 宽度和高度!
【发布时间】:2011-01-27 07:03:52
【问题描述】:

我将使用 jQuery UI.Layout Plug-inJQuery UI resizable 插件。

the container layout example of JQuery UI layout plugin:

我的代码结构是这样的:

html代码:

<div id="container">

    <div id="paddingWrapper" class="pane ui-layout-center">

        <div class="pane ui-layout-center">

            Center

            <p><a href="http://layout.jquery-dev.net/demos.html"><b>Go to the Demos page</b></a></p>

        </div>

        <div class="pane ui-layout-north">North</div>

        <div class="pane ui-layout-south">South</div>

        <div class="pane ui-layout-east">East</div>

        <div class="pane ui-layout-west">West</div>

    </div>

</div>

div id="container" 将附加 jquery ui resizable pluginjquery ui draggable plugin

代码附加布局UI插件:

$(document).ready(function () {

    $('#container').layout();

});

但似乎当我调整 div id="container" 的大小时,布局被破坏了。内部内容保留原来的高度和高度。所以,我需要一种方法来让 inner 的布局在我调整它们的容器大小时可以自动调整大小。

非常感谢!!

【问题讨论】:

    标签: jquery layout resizable


    【解决方案1】:

    我不知道这个布局插件,但它看起来很有趣......谢谢!

    查看布局的documentation,有一个名为resizeAll() 的方法“调整整个布局的大小以适合其容器”。我真的不明白他们给出的例子,但我想你可能想使用它。否则,您可以从可调整大小的停止事件中调用此函数:

    $("#container").resizable({
      stop: function(){
        $("#paddingWrapper").layout("resizeAll");
      }
    });
    

    【讨论】:

    • 当我调整浏览器窗口大小时,似乎调用了一个调整大小函数来重新调整所有面板。但我没有得到 resizeAll 来调整 div 大小
    • 谢谢,你帮了我很多!来自我的 +1 :)
    猜你喜欢
    • 2012-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多