0
我想通過拖放來配對元素。匹配方法是divs中的隱藏文本。用戶必須將該元素從「.answerContainer」拖放到正確的「.circle」div中。使用jQuery UI「拖放」對象div
的HTML代碼:
<div class="circleContainer">
<div class="circle first lineOne"> <span class="question">1</span></div>
<div class="circle second lineOne"><span class="question">2</span></div>
<div class="circle third lineTwo"> <span class="question">3</span></div>
</div>
<ul class="answerContainer">
<li class="first"> <span class="answer">1</span></li>
<li class="second"> <span class="answer">2</span></li>
<li class="third"> <span class="answer">3</span></li>
</ul>
我想這一點,但它不工作:
$(".answerContainer li").draggable({
revert: "invalid",
containment: "document",
cursor: "move"
});
$(".circle").each(function(i){
$this=$(this);
$this.droppable({
accept: function(event, ui) {
if($this.text()==event.text()){
return true;
}
},
activeClass: "ui-state-highlight",
drop: function(event, ui) {
deleteAnswer(ui.draggable);
}
});
});
喔,是的,空格!非常感謝你! – Bergkamp