How do I destroy a jquery resizable without destroying child resizables?

人走茶凉 提交于 2019-12-05 03:43:30

I think this happens because the destroy of resizable removes all resize handels inside of the ui element, which happens to include the resize handles for the inside resizables. So the inside resizables aren't actually being destroyed, they're just getting messed up.

You can see the Resizable source code here; its happening at line 199 where it says .find('.ui-resizable-handle').remove();.

To fix this you need to call the destroy method on the inner resizables also and then recreate them. (jsfiddle)

$("div").resizable();

// Destroy all three resizables
$("div").resizable("destroy");

// Recreate the inner resizables
$("#idInnerOne, #idInnerTwo").resizable();

You need to do that to remove bindings and data that resizable sets up upon creation, otherwise it will think its already created when you try re-creating it and it will do nothing.

You might also consider disabling the outer resizable instead of destroying it, but that has its own issues.

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