문제

I am using jQuery UI Sortable 'portlets'.

I want to add Resize function to it as in jQuery UI

I have tried my Sortable in this Fiddle

My Code:

$(function() {
    $(".column").sortable({
    connectWith: ".column"
    });
    $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
    .find(".portlet-header")
    .addClass("ui-widget-header ui-corner-all")
    .prepend("<span class='ui-icon ui-icon-minusthick'></span>")
    .end()
    .find(".portlet-content");

    $(".portlet-header .ui-icon").click(function() {
       $(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick");
       $(this).parents(".portlet:first").find(".portlet-content").toggle();
    });
    $(".column").disableSelection();
});
도움이 되었습니까?

해결책

You can't have a fixed width .column and then have the ability to resize an element to be wider than the column width. Let the .column width be auto and move the width to the .portlet - see demo or below for the change.

.column {
    float: left;
    padding-bottom: 100px;
}
.portlet {
    width: 170px;
    margin: 0 1em 1em 0;
}

Also, as @SanketS already answered and @Rudy commented, you need to add $('.portlet').resizable() to make the elements resizable.

다른 팁

Add $( ".portlet" ).resizable(); in your jquery code. DEMO

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top