jQuery Resizable handles setter not working

五迷三道 提交于 2019-12-04 05:30:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!