2014-04-11 33 views
1

这里是我的小提琴:排序列表W /递增值

http://jsfiddle.net/WV8du/24/

我想对于这些数字基于列表中的项目的值/量增加/减少。感谢您的帮助/提示。

$(function() { 
    $("#sortable-primary").sortable({ 
     placeholder: "ui-state-highlight", 
     connectWith: ".connected-sortable" 
    }); 
    $("#sortable-secondary").sortable({ 
     placeholder: "ui-state-highlight", 
     connectWith: ".connected-sortable" 
    }); 
    $("#sortable-primary, #sortable-secondary").disableSelection(); 
}); 

回答

1

我认为你需要把这些项目放在一个UL中,这肯定会使它更加简单。我没有完全清理CSS,但我认为这会让你开始。这至少是一种解决方案。

function numberLi(){ 
    var i = 1; 
    $('#sortable-primary > .ca-nav-move > .num').each(function(){ 
    $(this).text(i); 
    i++; 
    }); 

    $('#sortable-secondary > .ca-nav-move > .num').each(function(){ 
    $(this).text(""); 
    }); 
} 

Here is the fiddle

Here is an updated fiddle,将从底部列表拖在那里当删除号码。

我不喜欢用数字拖动项目的方式,我决定我可以做得更好。 Here is a 3rd fiddle,其执行方式完全符合您的要求。请将此标记为已接受的答案。

+0

谢谢!这不仅仅是帮助,非常感谢。 :) – Smurfman82