【发布时间】:2015-12-30 07:16:54
【问题描述】:
我有两个 div 部分,我正在执行拖放和可排序操作 我的可拖动部分中有 5 个可拖动记录的列表 我想在放入可放置部分后立即禁用可拖动记录以避免放置重复记录在可放置的 div 部分中
HTML 代码
<div>
<form method="post" action="">
<ol style='list-style:decimal' id="qselected"></ol>
</form>
</div>
<br/>
<div>
<ul id="qlist">
<?php
for($i=1;$i<=5;$i++)
{
?>
<li id='article_<?php echo $i;?>' >
<div class="qitem" style='margin-bottom : 20px;border-bottom:1px solid #e7e7e7;'>
<span data-item="1" class="question">Value : <?php echo $i;?></span>
</div>
</li>
<?php
}
?>
</ul>
</div>
JQUERY 代码
$(document).ready(function() {
$("#qselected").disableSelection();
$(".qitem").draggable({
containment : "#container",
tolerance:"pointer",
helper : 'clone',
refreshPositions: true ,
revert : 'invalid',
opacity:.4
});
$("#qselected, #qlist").droppable({
revert:true,
hoverClass : 'ui-state-highlight',
greedy: true,
refreshPositions: true,
drop : function(ev, ui) {
$(ui.draggable).clone().appendTo(this);
if($(this)[0].id === "qselected")
{
console.log($(this).closest("button").find('.hello'));
$(this).find('.hello').hide();
$(this).find('.btn').show();
return true;
}
},
}).sortable({
revert: true,
refreshPositions: true ,
helper : 'clone',
cursor: "move",
delay: 1,
tolerance: 'pointer',
revert: 50
});
});
【问题讨论】:
-
你能做一个小提琴吗?
标签: javascript php jquery html jquery-ui