拖放多个后,我希望取消选项,以便所有 div 在按下时恢复到原始状态和位置。
HTML:
<div class="connected">
<div class="myDivs">Hello 01</div>
<div class="myDivs">Hello 02</div>
<div class="myDivs excludeThisCss">Hello 03</div>
<div class="myDivs">Hello 04</div>
<div class="myDivs">Hello 05</div>
<div class="myDivs excludeThisCss">Hello 06</div>
<div class="myDivs">Hello 07</div>
<div class="myDivs">Hello 08</div>
<div class="myDivs excludeThisCss">Hello 09</div>
<div class="myDivs">Hello 10</div>
</div>
<button id="demo1" onclick="cancel()" title="Button">Cancel</button>
JavaScript:
$(function() {
$(".connected").sortable({
connectWith: ".connected",
items: ".myDivs:not(.excludeThisCss)"
}).disableSelection();
});
function cancel() {
// alert('cancelled');
}
见小提琴:http: //jsfiddle.net/adrianjsfiddlenetuser/zyUkd/6/
我已经看到使用 .load 函数的示例,但我不想加载新数据,只需刷新 div