我需要将具有自己的 css 值的跨度拖放到 div 中,在放置时 div 将采用已删除跨度的 css 值。这是我的代码,但我需要制作它,因此无论跨度下降,div 都会采用该值。
这是我的html
$(document).ready(function() {
$('.drag1, .drag2, .drag3').draggable({ containment: 'document', revert: true });
$('#drop').droppable({ hoverClass: 'border, bgRed', tolerance: 'pointer', accept: '.drag1, .drag2, .drag3' });
});
.drag1 {
background-color: #900;
padding: 4px 10px;
cursor: pointer;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFF;
}
.drag2 {
background-color: #036;
padding: 4px 10px;
cursor: pointer;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFF;
}
.drag3 {
background-color: #060;
padding: 4px 10px;
cursor: pointer;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFF;
}
.border {
border: dotted 1px #999999;
}
.bgRed {
background-color:#900;
}
#drop {
height: 200px;
width: 200px;
padding: 10px;
margin-top: 10px;
}
<!--<link rel="stylesheet" type="text/css" href="css/style.css">-->
<span class="drag1" title="Drag Me">Red Header</span>
<span class="drag2" title="Drag Me">Blue Header</span>
<span class="drag3" title="Drag Me">Black Header</span>
<div id="drop"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<!--<script src="js/ui.js"></script>-->
希望有人可以帮助