I am using the latest version of JQuery and JQuery UI to understand drag and drop features. I am facing a minor problem - mostly due to mouse drag.
As you can see that I am creating stacks with some items in it.
Now if these stacks are just inside body - I mean div.allstacks is in body there is no problem. But as soon as I put all these stacks inside a div#left-panel, the problem of cursor losing focus starts.
This means now when I drag an item, after horizontal scroll - My mouse cursor is not at the same position of draggable note.
Now here is the problem:
JSFiddle Link [Working without div#left-panel]: http://jsfiddle.net/deveshz/YvmFf/
JSFiddle Link [NOT Working with div#left-panel] http://jsfiddle.net/deveshz/YvmFf/1/
Here is the code.
Javascript:
var zindex = 10;
$(".item").draggable({
containment: "body",
scroll: true,
revert: function (event, ui) {
$(this).css("border", "none");
return !event;
},
start: function (event, ui) {
$(this).css("z-index", zindex++);
$(this).css("border", "2px solid #333");
}
});
$(".stack_items").droppable({
hoverClass: "over",
drop: function (event, ui) {
$("<li class='item'></li>").html(ui.draggable.html()).appendTo(this);
$(ui.draggable).remove();
}
});