0

大家好我有一个网站,我在 div 中上传 Ajax 中的图像,该图像必须是可调整大小和可拖动的。问题是如果我调整它的大小,工作,如果我拖动它似乎有一个溢出:隐藏,因为我向左拖动图像在其限制后消失。我看过html代码并且有

ui-wrapper style="overflow:hidden..."

如果我放入我的样式表:

.ui-wrapper { 
    overflow:visible !important;
}

拖动有效,但现在无法调整大小!!!我该如何解决?

这是代码:

.ui-wrapper { 
    overflow:visible !important;
}

$(document).ready(function(){

    var options = { 
        beforeSubmit: showRequest, 
        success:    showResponse
    }; 

    $('#upload-form').ajaxForm(options);
});

function showResponse(responseText){
    var id = 'image-resize_'+n_img_created;
    n_img_created++;
    $('<img class="draggable" id="'+id+'" '+responseText+'/>').appendTo("#space-drawable-div").resizable({
            maxWidth: 212,
            maxHeight: 220,
            start: function( event, ui ) {
                console.log('start resizable');
            },
            stop: function( event, ui ) {
                console.log('stop resizable');
            }
        }).draggable({ containment: $('#space-drawable-div')});
}
4

1 回答 1

3

将图像包装在一个 div 中。然后使该 div 可调整大小和可拖动。要允许调整图像大小,请继续使用“alsoResize”选项:$(“.divSelector”).resizable({alsoResize:“#imageSelector”});

发生的情况是,如果您不这样做,jQuery UI resizable 将用 div (这是不可见的部分)包装您的图像。

于 2013-06-01T19:58:17.420 回答