Reputation: 58
i have read the resizable of jQuery UI. after that i use the code and got success. but now i do not understand the "option" in the line
$( ".selector" ).resizable({ handles: 'n, e, s, w' });
Get or set the handles option, after init.
//getter
var handles = $( ".selector" ).resizable( "option", "handles" );
//setter
$( ".selector" ).resizable( "option", "handles", 'n, e, s, w' );
in the example what is option. perticularly last line $( ".selector" ).resizable( "option", "handles", 'n, e, s, w' );
.
Upvotes: 0
Views: 877
Reputation: 165961
option
is a method. jQuery UI methods tend to be executed by calling the widget function (in this case resizable
) with a string representing the method name as the first argument.
The second argument is the name of the option you want to get/set, and the third argument, if present, is the value to set the option to.
In a similar way, you could enable or disable the widget:
$(".selector").resizable("enable"); //Call the enable method
$(".selector").resizable("disable"); //Call the disable method
$(".selector").resizable("option", "handles"); //Call the option method, get the handles option value
For example, if you wanted to know whether or not the resizable
is enabled or not, you could do:
//If it's disabled, disabled == true. If not, disabled == false
var disabled = $(".selector").resizable("option", "disabled");
//After the following line, the resizable element will be in the opposite state
//(if it was enabled, it will be disabled, and vice versa)
$(".selector").resizable("option", "disabled", !disabled);
Upvotes: 2