jQuery调整插件最小宽度,具体取决于拖动的边缘
问题描述:
Possible Duplicate:
Jquery resizable plugin, set minWidth depending on the dragging edge
如何根据要拖动的元素的边缘设置minWidth和height?
How can i set the minWidth and height depending on which edge of the element is being dragged?
答
有点奇怪的交互作用,但这就是( jsfiddle )
Kind of a weird interaction, but here it is (jsfiddle)
$(function() {
$( "#resizable" ).resizable({
handles : 'e, n, s, w',
resize : function(event, ui){
switch($(this).data('resizable').axis)
{
case 'n':
$(this).resizable( "option", "minHeight", 75 );
break;
case 's':
$(this).resizable( "option", "minHeight", 100 );
break;
case 'e':
$(this).resizable( "option", "minWidth", 150 );
break;
case 'w':
$(this).resizable( "option", "minWidth", 200 );
break;
}
}
});
});