2013-08-06 58 views

回答

0

你可以试试这个,带有索引玩:

$(function(){ 
var startIndex = false; 
$('ul').sortable({ 
    items: ' > li', 
    start: function(event,ui){ 
     startIndex = ui.item.index(); 
    }, 
    stop: function(event,ui){ 
     if(false !== startIndex) { 
      $('#result').html('<br />Element on the original place of the moved element: ' + $('li:eq('+startIndex+')').text() + ' '); 
     } 
     startIndex = false; 
    } 
}); 

});

这里是小提琴:http://jsfiddle.net/m3cSu/

相关问题