Trying to drag and drop my system labels in to the droppable area. When the item is dropped in the droppable area it should be at the same position as the mouse.
// this is the JQ selector, you are using an ID field selector when you use `#` such as #system-label
//If you wanted to select one and one only, you would use #system-label-1
// You want to apply them to all, so you should use a class selector `.` such as .stamp
$('.stamp').draggable({
revert: 'invalid',
helper: 'clone',
drag: function (event, ui) {}
})
$('#droppable-area').droppable({
accept: '.stamp',
drop: function (event, ui) {
var newDiv = $(ui.helper).clone(false)
.css({
position: 'absolute',
left: ui.offsetX,
top: ui.offsetY
});
$('#droppable-area').append(newDiv);
}
})
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.