关于这个错误有很多未解决的问题。
这是适合您的解决方案:)
http://jsfiddle.net/882k9/
<script>
var changedRatio = "DK"; //DK->dont keep
var nowResizing = "NO";
$(function() {
$('#resizable').resizable({
start:function(event,ui){
nowResizing = "YES";
},
stop:function(event,ui){
nowResizing = "NO";
}
});
$(document).on('mouseenter', '.ui-resizable-e', function(){
if(changedRatio!="DK"){
if(nowResizing!="YES"){
var targetDiv = $(this).parent().attr("id");
dontKeep(targetDiv);
}
}
});
$(document).on('mouseenter', '.ui-resizable-se', function(){
if(changedRatio!="K"){
if(nowResizing!="YES"){
var targetDiv = $(this).parent().attr("id");
keep(targetDiv);
}
}
});
$(document).on('mouseenter', '.ui-resizable-s', function(){
if(changedRatio!="DK"){
if(nowResizing!="YES"){
var targetDiv = $(this).parent().attr("id");
dontKeep(targetDiv);
}
}
});
});
function dontKeep(val){
$("#"+val).resizable("destroy");
$("#"+val).resizable({
aspectRatio:false,
start:function(event,ui){
nowResizing = "YES";
},
stop:function(event,ui){
nowResizing = "NO";
}
});
changedRatio = "DK";
}
function keep(val){
$("#"+val).resizable("destroy");
$("#"+val).resizable({
aspectRatio:true,
start:function(event,ui){
nowResizing = "YES";
},
stop:function(event,ui){
nowResizing = "NO";
}
});
changedRatio = "K";
}
</script>
<div id="resizable" class="ui-widget-content">
<h3 class="ui-widget-header">Resizable</h3>
</div>