jquery ui resizable custom handle error

不问归期 提交于 2019-12-02 17:15:00

问题


Im trying to get a custom handle work with jquery ui resizable widget, but when I use the handles option to pass in a jquery reference to another element, it fails. From what Iv read from the documentation and other examples on the web, this should work just fine.

<div class="layer">
<div class="left">left</div>
<div class="center">center</div>
<div class="right">right</div>
</div>
​
$('.layer').resizable({
    handles: {
        'e': $('.right')
    }
});
​

Here's a fiddle: http://jsfiddle.net/MatteS75/3dwVp/


回答1:


I found a workaround.

By setting the handles option to null, and setting the classes myself, I got my custom handle to work. This required some investigation in the jquery ui code to figure out.

<div class="layer" style="width: 150px;">
<div class="left">left</div>
<div class="center">center</div>
<div class="right ui-resizable-handle ui-resizable-e">right</div>
</div>
​
$('.layer').resizable({
    handles: null
});
​

http://jsfiddle.net/MatteS75/3dwVp/7/

However, I do think this is a jquery ui bug, releated to this question: overriding a jquery ui widget string option with an object




回答2:


This is a bug that has been fixed very recently:

http://bugs.jqueryui.com/ticket/8713

https://github.com/jquery/jquery-ui/commit/9b908878ae3a9c0fbbd9958b579f223a648c5c69



来源:https://stackoverflow.com/questions/13028342/jquery-ui-resizable-custom-handle-error

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