我有一个网站,我有一组要限制为仅在放入特定可放置对象时显示其信息的可拖动对象。
这是我的代码:
<script type = "text/javascript">
$(function() {
$(".draggablem").draggable({
revert: true,
opacity: .75,
containment: '.container',
cursor: 'move',
cursorAt: {
top: 25,
left: 75
}
});
$(".draggableo").draggable({
revert: true,
opacity: .75,
containment: '.container',
cursor: 'move',
cursorAt: {
top: 25,
left: 75
}
});
$(".dropable").droppable({
activeClass: 'dragactive',
hoverClass: 'drophover',
drop: function(event, ui) {
$(this).addClass('drophighlight').find('p').html('<br />' + ui.draggable.children("span").text());
}
});
$(".dropable2").droppable({
activeClass: 'dragactive',
hoverClass: 'drophover',
drop: function(event, ui) {
$(this).addClass('drophighlight').find('p').html('<br />' + ui.draggable.children("span").text());
}
});
});
</script>
我想限制.draggablem
to.dropable
和.draggableo
to .dropable2
。
非常感谢。