I have created multiple hotspots which are draggable, but my problem is in same container there is one section; in that section I don't want to drop draggable element. Please check below snippet.
$(".draggable").draggable({
containment: ".container",
});
.container{
width:100%;
position:relative;
height:300px;
background:#eaeaea;
}
label{display:inline-block;}
.draggable {
position: absolute!important;
min-width: 85px;
border: none!important;
background: transparent!important;
top:0;
left:0;
z-index:1;
}
.draggable label:first-child{
background:blue;
border:1px solid green;
width:10px;
height:10px;
border-radius:50%;
float:left;
margin-top:3px;
margin-right:10px;
}
.draggable label:last-child {
overflow: hidden;
max-width: 100px;
word-wrap: break-word;
padding: 5px;
background: #9afff1;
}
.section {
position: absolute;
width: 240px;
height: 100px;
background: #dfbaba;
bottom: 0;
border: 1px solid #d5a1a1;
}
<link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div class="container">
<div class="draggable">
<label></label>
<label>hotspot1</label>
</div>
<div class="draggable">
<label></label>
<label>hotspot2</label>
</div>
<div class="draggable">
<label></label>
<label>hotspot3</label>
</div>
<div class="section">
</div>
</div>
In above snippet hotspots are droppable on that red background section. How to prevent that? Please check below image for better understandig.
Also on drop how to check two hotspots are overlapped on not? If two hotsots are overlapping each other then I want to change class which will change direction of hotspot. Thanks