1

I'm trying to change the handler on a resizable element but it don't seems to works.

I used :

$(line)
    .draggable({containment:"parent"})
        .resizable({
            containment:"parent",
            handles: "e, w"
        });

and now I want to pass the handler from "e, w" to "n, s", but when I do :

$(line)
.resizable({
    containment:"parent",
    handles: "n, s"
});

My handlers don't change. Why ?

Thanks for your attention.

M. Ozn
  • 1,018
  • 1
  • 19
  • 42

1 Answers1

2

The option setter for this option is currently missing: bug link but once it gets resolved you can call the resizable setOption method for the handles option:

$(line).resizable("option", "handles", "n, s");

Meanwhile do the following:

var options = {
    containment:"parent",
    handles: "e, w"
};
$(line)
.draggable({containment:"parent"})
    .resizable(options);

Then when changing the handles do:

options.handles = "n, s";
$(line).resizable("destroy");
$(line).resizable(options);
Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
  • I'm happy you can read that piece of code, OP's line breaks really confuse me `乁(@﹏@)ㄏ` – Clemens Himmer Jan 11 '16 at 14:25
  • @MaximeOzenne This is called after the resizble is already initialized. http://api.jqueryui.com/resizable/#option-handles – Konstantin Dinev Jan 11 '16 at 14:26
  • Ok I think I have something wrong with my code... Thanks anyway i'll try to make it works – M. Ozn Jan 11 '16 at 14:28
  • Update the question will all of the code so I can look at it :) – Konstantin Dinev Jan 11 '16 at 14:29
  • This is a big project, normally it's a dynamic div added by a button which took the resizable function, I think it will a bit confusing – M. Ozn Jan 11 '16 at 14:31
  • It's seems to be a known bug : http://stackoverflow.com/questions/23513019/jquery-resizable-handles-setter-not-working – M. Ozn Jan 11 '16 at 14:35
  • I see, the setOption is missing. What I will suggest is to modify the object you instantiate with and to call destroy on the widget and instantiate it again. I will update the answer. – Konstantin Dinev Jan 11 '16 at 14:38