最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Resizing issue with jQuery sortable resizable draggable - Stack Overflow

programmeradmin1浏览0评论

I made a sortable, resizable, draggable, with-clone portlet but when I resize it I run into a bug.

My script:

<script type="text/javascript"> 

$(function() {
    $('#column1').draggable({
        helper:'clone',
        connectToSortable:'#sort',
        handle:'.widget-head',
    });

    $('#sort').sortable({ 
        handle:'.widget-head',
        connectWith: "#sort",
        out: function (e,ui) {
            $("#sort").children().resizable({ axis: 'x',containment: 'parent',
                resize:
                function(event, ui) 
                {
                    ui.size.width = ui.originalSize.width;
                }
            });
        } 
    });
});

</script>

I made a sortable, resizable, draggable, with-clone portlet but when I resize it I run into a bug.

My script:

<script type="text/javascript"> 

$(function() {
    $('#column1').draggable({
        helper:'clone',
        connectToSortable:'#sort',
        handle:'.widget-head',
    });

    $('#sort').sortable({ 
        handle:'.widget-head',
        connectWith: "#sort",
        out: function (e,ui) {
            $("#sort").children().resizable({ axis: 'x',containment: 'parent',
                resize:
                function(event, ui) 
                {
                    ui.size.width = ui.originalSize.width;
                }
            });
        } 
    });
});

</script>
Share edited Mar 12, 2011 at 8:51 Tim Stone 19.2k6 gold badges57 silver badges66 bronze badges asked Mar 10, 2011 at 16:04 strawberrystrawberry 1671 silver badge13 bronze badges 1
  • here an execution jsfiddle/sika/69fpn – strawberry Commented Mar 10, 2011 at 16:31
Add a ment  | 

1 Answer 1

Reset to default 7

I figured out that the problem was related to the styling and was able to fix it. The position changed to absolute every time I resized, so to handle that I'm using this:

$('#sort').sortable({ 
    handle:'.widget-head',
    connectWith: "#sort",
    out: function (e,ui) {
        $("#sort").children().resizable({
            axis: 'x',
            containment: 'parent',
            resize: function(event, ui)  {
                ui.size.width = ui.originalSize.width;
                (ui.helper).css({'position': '', 'top': '0px'});
            }
        });
    } 
});
发布评论

评论列表(0)

  1. 暂无评论