$(document).ready(function() {
$( "ul.dropfalse" ).sortable({
connectWith: "ul.dropfalse",
cursor: 'crosshair',
opacity: 0.8,
placeholder: "ui-state-highlight",
revert: true,
scroll: true,
update: function (event, ui) {
var target = event.target.id;
alert(target);
var order = $(this).sortable('serialize');
$("#update").load("tabsitem.php?"+order);
alert("update")
}
});
$( "#sortable" ).disableSelection();
$( "#tabs" ).tabs();
})
<div id="tabs">
<ul>
<li><a href="#tabs-1">Tab 1</a></li>
<li><a href="#tabs-2">Tab 2</a></li>
<li><a href="#tabs-3">Tab 3</a></li>
</ul>
<div id="tabs-1">
<ul id="sortable1" class='dropfalse'>
<li id="TABItem_11"><img src="arrow.png" alt="move" />1st TAB.Item 1</li>
<li id="TABItem_12"><img src="arrow.png" alt="move" />1st TAB.Item 2</li>
<li id="TABItem_13"><img src="arrow.png" alt="move" />1st TAB.Item 3</li>
<li id="TABItem_14"><img src="arrow.png" alt="move" />1st TAB.Item 4</li>
<li id="TABItem_15"><img src="arrow.png" alt="move" />1st TAB.Item 5</li>
</ul>
</div>
<div id="tabs-2">
<ul id="sortable2" class='dropfalse'>
<li id="TABItem_21"><img src="arrow.png" alt="move" />2nd TAB.Item 1</li>
<li id="TABItem_22"><img src="arrow.png" alt="move" />2nd TAB.Item 2</li>
<li id="TABItem_23"><img src="arrow.png" alt="move" />2nd TAB.Item 3</li>
<li id="TABItem_24"><img src="arrow.png" alt="move" />2nd TAB.Item 4</li>
<li id="TABItem_25"><img src="arrow.png" alt="move" />2nd TAB.Item 5</li>
</ul>
</div>
<div id="tabs-3">
<ul id="sortable3" class='dropfalse'>
<li id="TABItem_31"><img src="arrow.png" alt="move" />3rd TAB.Item 1</li>
<li id="TABItem_32"><img src="arrow.png" alt="move" />3rd TAB.Item 2</li>
<li id="TABItem_33"><img src="arrow.png" alt="move" />3rd TAB.Item 3</li>
<li id="TABItem_34"><img src="arrow.png" alt="move" />3rd TAB.Item 4</li>
<li id="TABItem_35"><img src="arrow.png" alt="move" />3rd TAB.Item 5</li>
</ul>
</div>
</div>
<pre>
<div id="update">Waiting for update</div>
</pre>
还有另一个问题:为什么当我进入另一个标签时,该项目总是被放到列表中的第4位? 感谢任何人都可以帮助我。
答案 0 :(得分:0)