Finally, drag, drop and resize works even with forward, backward and remove buttons!
http://jsfiddle.net/fX262/11/
http://jsfiddle.net/fX262/11/embedded/result/
Applying resize on img tag didn't work. Only on block elements it works. So I wrapped img tag in a block element and applied jQuery UI on it.
Also adding IDs to clones and verifying them did the trick like this:
if ($(ui.draggable)[0].id !== "") {
x = ui.helper.clone();
ui.helper.remove();
x.addClass("borrd-item");
x.draggable({
helper: 'original',
containment: '#borrd-droppable',
tolerance: 'fit',
start: function (event, ui) {
$(this).css("z-index", a++);
}
});
}
Is this a bug in jQuery UI itself?
Right now the other issues are:
Why when we drag and drop images to the left side, images position far below than the actual position? I removed all paddings and margins on the elements like inputs and div containers above "borrd-droppable" div. The images now position less below than before. So I think this is some kind of CSS issue.
When overlapping images, if we click forward few times on one image, it's z-index is increased to far more than other images. Now if that image has to go backward, we have to click few more times. Instead of that can it be made to move backward to the next image in just one click?
canvas2html also works but only in Firefox. Not it Google Chrome. I even tried $(window).load function. Doesn't work. Know why?
Btw, even though I post the code and description this question didn't get a single reply. It is demotivating for a newbie like me in Stack Overflow.