简体   繁体   English

div的最小高度和宽度

[英]miminum height and width of a div

I have a re-sizable and drag able div in my page I want to restrict users to re size the DIV to a fixed minimum width or height and cannot resiz more than that. 我的页面上有一个可调整大小且可拖动的div,我想限制用户将DIV的大小重新调整为固定的最小宽度或高度,并且不能再调整大小。

i did try it using the following code but it did not help. 我没有尝试使用以下代码,但没有帮助。 please guide me to solve this. 请指导我解决这个问题。

$("#dv_move").resizable({
            resize: function () {
                var t = $(this);
                if (parseInt(t.width()) < 300 || parseInt(t.height()) < 150)
                    return false;
            }
        });

I just Google'd "jquery resizable", clicked the first option, then looked at the "options" tab. 我只是Google的“可调整大小的jQuery”,单击第一个选项,然后查看“选项”选项卡。

http://jqueryui.com/demos/resizable/ http://jqueryui.com/demos/resizable/

Specifically, the minWidth and minHeight options. 特别是, minWidthminHeight选项。

It's amazing what you can find if you look. 如果您能看到的话,那真是太神奇了。

This should work : 这应该工作:

    $("#dv_move").resizable({
        minWidth: 300,
        minHeight: 300
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM