Jquery Draggable AND Resizable

前端 未结 6 523
终归单人心
终归单人心 2020-12-01 08:03
function makeResourceDrag(arrIndexID) {

    $(\'#imgA\' + arrIndexID).resizable();

    $(\'#imgA\' + arrIndexID).draggable({
        start: function(event, ui) {
          


        
6条回答
  •  鱼传尺愫
    2020-12-01 08:45

    Looks like it's because you're doing it on an , which jqueryui wraps in a

    , and then the draggable component of the image happens within the wrapping
    .

    Try wrapping the in a

    (which if styled display:inline-block, will "hug" the size of the image in both x and y axes), make the
    draggable (and therefore the enclosed will be as well), and make the resizable (and since the div hugs the image, it all sits nicely).

    Working example: http://jsfiddle.net/vrUgs/2/

提交回复
热议问题