开发者

UI Drag'n'Drop in JQuery

开发者 https://www.devze.com 2023-04-11 11:04 出处:网络
I\'m working on Drag\'n\'Drop interface. Everything works OK. I need help with some additional functionality.

I'm working on Drag'n'Drop interface. Everything works OK. I need help with some additional functionality.

I have 3 columns with dragged items. Every item have a title number: 1,2,3,... I want to change the number in the panel title to reflect the order of the panel in the column (so if you drag a panel to the top开发者_Python百科 it becomes 1 and the panels below it 2, 3 etc.).


Is this what you want?

$( ".content .draggable-area" ).sortable({
    connectWith: ".draggable-area",
    tolerance: "pointer",
    cursor: "move",
    cursorAt: {top: 10, left: 10},
    distance: 30,
    opacity: 0.8,
    stop: function(event, ui) {
        $('.draggable-area').each(function(){
            $(this).find('.draggable-box').each(function(){
               $(this).find('h2').html($(this).index()+1); 
            });
        });
    }
});

demo:
http://jsfiddle.net/Xr3ne/1/

0

精彩评论

暂无评论...
验证码 换一张
取 消