【问题标题】:I want to change the width of the item while dragging from the sortable lists我想在从可排序列表中拖动时更改项目的宽度
【发布时间】:2011-11-14 07:01:41
【问题描述】:

我需要在从可排序列表中拖动时更改项目的宽度。

这里是使用下面的jquery

$(function() {
    $( ".dropfalse" ).sortable({
            connectWith: ".dropfalse",
            revert: true,           
            tolerance: 'pointer'    
        }).disableSelection();
    $('#sortable1 li').draggable({
        connectToSortable: ".dropfalse",
        helper: "clone",
    }); 
}); 

【问题讨论】:

    标签: jquery jquery-ui-sortable


    【解决方案1】:

    在拖动时,您可以使用 $("selector").css("property","value"); 修改 CSS;

    【讨论】:

    • 我用过,但是占位符改变了宽度:$(".dropfalse").sortable({connectWith:".dropfalse",revert:true,tolerance:'pointer',placeholder:"ui -state-highlight", start: function(event, ui) { $("#sortable2 li").css("width","150px"); $("#sortable3 li").css("width", "150px"); }, stop: function(event, ui) { $("#sortable2 li").css("width","100%"); $("#sortable3 li").css("width ","100%"); } }).disableSelection();
    • 如果可能的话,你能为此创建一个 JsFiddle 吗?这会更有帮助。或者,您可以检查要调整大小的元素的 id 并将该 id 用作选择器。
    猜你喜欢
    • 1970-01-01
    • 2013-12-17
    • 2010-10-16
    • 2018-12-03
    • 1970-01-01
    • 2017-11-17
    • 2010-10-18
    • 1970-01-01
    • 2014-05-17
    相关资源
    最近更新 更多