jQuery UI Dialog minWidth扩展对话框

时间:2015-10-20 05:22:08

标签: javascript jquery json jquery-ui

我使用JSON动态添加对话框(为示例硬编码)。我的问题是对话框属性'minWidth' - 'minHeight'工作正常。当我调整窗口大小并达到设置的minWidth时,对话框会扩展到超过1600px(minWidth:200)。 任何解决方案?

代码:

var fenster =
[
    {
        "title": "Window 1",
        "height": "500",
        "width": "500",
        "minheight": "100",
        "minwidth": "100",
        "inhalt": '<img src="Images\\awesome.jpeg" />'
    },
    {
        "title": "Window 2",
        "height": "300",
        "width": "300",
        "minheight": "200",
        "minwidth": "210",
        "inhalt": '<img src="Images\\awesome.jpeg" /><img src="Images\\awesome.jpeg" />'
    },
    {
        "title": "Window 3",
        "height": "400",
        "width": "400",
        "minheight": "200",
        "minwidth": "200",
        "inhalt": '<img src="Images\\awesome.jpeg" /><img src="Images\\awesome.jpeg" /><img src="Images\\awesome.jpeg" />'
    }
];
        for (i = 0; i < fenster.length; i++) {
            var div1 = document.createElement("div");
            div1.innerHTML = ("<a class=\"modalClick" + i + "\" href=\"#\">Window" + i + "</a>");

            $('#body').append(div1);

            var div2 = document.createElement("div");
            div2.id = "mbox" + i;
            div2.style.display = "none";
            div2.innerHTML = fenster[i].inhalt;

            $('#body').append(div2);

            eval("$(function () {" +
                "$(('.modalClick'+" + i + ")).on('click', function(){createWindow(" + i + ");});" +
            "});"
            );
        }


        function createWindow(i) {
            var f = fenster[i];
            $(('#mbox' + i)).dialog({
                title: f.title,
                width: f.width,
                height: f.height,
                minHeight: f.minheight,
                minWidth: f.minwidth,
                stack: true,
                fluid: true
            });
        }

    </script>

0 个答案:

没有答案