问题
i'm using jQuery UI Resizable, and i need to set handles option after the initialization.
I followed the API example and initialization method works just fine, but setter method seems not working. Am i missing anything?
// Initialization works fine!
$('#containerGreen').resizable( { handles: "n, e, s, w" } );
// Setter NOT working
$('#containerRed').resizable();
$('#containerRed').resizable( "option", "handles", "n, e, s, w" );
Live Demo
回答1:
It's a known bug:
http://bugs.jqueryui.com/ticket/3423
Workaround from the issue:
A dirty solution is to enable all the handlers that you are going to need on init.
Add a class like the following in CSS
.ui-hide-handler { width:0 !important; height:0 !important; }
and add/remove the class to the handler DIVs according to your needs
$('.ui-icon-gripsmall-diagonal-se', element).addClass('ui-hide-handler'); $('.ui-resizable-sw', element).addClass('ui-hide-handler');
As I said, it's dirty solution but it works.
来源:https://stackoverflow.com/questions/23513019/jquery-resizable-handles-setter-not-working