Reputation: 683
I have a droppable
div
that contains child elements that are not droppable
.
For some reason, if you drop on the first child element, the drop
event is not triggered, but it is on the second child element.
Here's a JSFiddle example: http://jsfiddle.net/bppn33q3/1/
Why is this? And how can I fix it?
EDIT: Wrong fiddle
Upvotes: 1
Views: 186
Reputation: 240928
It actually is working. Look at what happens when you remove margin-top: 50px
.
.drag {
padding: 10px;
width: 25%;
background-color: aqua;
}
As you can see, the margin
affects the placement calculations.
You could always play around with the tolerance
option - (example).
$('.drop').droppable({
accept: '.drag',
tolerance: "pointer",
drop: function () {
alert('dropped');
}
});
Upvotes: 1
Reputation: 904
Playing with your fiddle, it appears that the issue is the css.
Check out my new fiddle after I removed your margin:
http://jsfiddle.net/bppn33q3/2/
.drag {
padding: 10px;
width: 25%;
background-color: aqua;
}
Upvotes: 1