tanweer
tanweer

Reputation: 83

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.

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;
            }
        });

Upvotes: 0

Views: 35

Answers (2)

gabitzish
gabitzish

Reputation: 9691

This should work :

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

Upvotes: 1

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324840

I just Google'd "jquery resizable", clicked the first option, then looked at the "options" tab.

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

Specifically, the minWidth and minHeight options.

It's amazing what you can find if you look.

Upvotes: 2

Related Questions