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.
I want to capture the double click event for each of cursor position so that if- Double click by horizontal re-size cursor, i can toggle width of current resizable between original and maximun available width.
- Double click by vertical re-size cursor, i can 开发者_如何学Pythontoggle height of current resizable between original and maximun available height.
- 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?
精彩评论