开发者

jQuery UI : Resizable Coustom Duoble-Click Event

copied following code from http://jqueryui.com/demos/resizable/#default

<meta charset="utf-8">
<style>#resizable { width: 150px; height: 150px; padding: 0.5em; }
#resizable h3 { text-align: center; margin: 0; }
</style>
<script>
$(function() {
$( "#resizable" ).resizable();
});
</script>
<div class="demo">
<div id="resizable" class="ui-widget-content">
    <h3 class="ui-widget-header">Resizable</h3>
</div>
</div>

It outputs this.

jQuery UI : Resizable Coustom Duoble-Click Event

I want to capture the double click event for each of cursor position so that if

  1. Double click by horizontal re-size cursor, i can toggle width of current resizable between original and maximun available width.
  2. Double click by vertical re-size cursor, i can 开发者_如何学Pythontoggle height of current resizable between original and maximun available height.
  3. Double click by diagonal re-size cursor, i can toggle width and height of current resizable between original and maximun available width and height.


The handlers have specific classNames:

ui-resizable-se//bottom right
ui-resizable-s//bottom
ui-resizable-e//right

You can select them and bind the dblclick:

$('.ui-resizable-se').dblclick(function(){alert('clicked bottom right handle');})

A pointer to the resizable you'll get inside the function using $(this).parent()


Use firebug to find out the elements you ant to attach the event (like: .ui-resizable-e - self explanatory) and use for example:

$(".ui-resizable-e").dblclick(myFunctionToResize);
Is that what you mean?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜