HI Everything
I want to achieve resizing, cloning, dragging and rotating on the image that will be shown to the user. I can do all this in a separate function, but I cannot include it in one function. Since images are dynamically created, I need one function. For example, if I join Drag, Drop, Clone with rezizable, it does not work properly.
thank
UPDATED
I can achieve functionality, but not in the way I expected. 1. How to rotate a fallen image?
2.I could not drag after reset due to resizing of the current request, which I added separately.
3. Hide () only hides the image, but the resize handle is still visible to users. How to remove resizable () while Hide () or is there any remove ()?
$(function() {
$('#frame img').live('mousemove', function(event) {
$('#frame img').resizable();
});
});
$(function() {
$('#frame img').live('dblclick', function(event) {
$(this).hide();
});
});
$(document).ready(function() {
counter = 0;
$("img").draggable({
helper: 'clone',
containment: '#frame',
stop: function(ev, ui) {
var pos = $(ui.helper).offset();
objName = "#clonediv" + counter
$(objName).css({ "left": pos.left, "top": pos.top });
$(objName).removeClass("drag");
$(objName).draggable({
containment: 'parent',
stop: function(ev, ui) {
var pos = $(ui.helper).offset();
}
});
}
});
$("#frame").droppable({
drop: function(ev, ui) {
if (ui.helper.attr('id').search(/drag[0-9]/) != -1) {
var pos = $(ui.helper).offset();
counter++;
var element = $(ui.helper).clone();
var rotateCSS = 'rotate(' + ui.position.left + 'deg)';
$(this).parent().css({
'-moz-transform': rotateCSS,
'-webkit-transform': rotateCSS
});
element.addClass("tempclass");
$(this).append(element);
$(".tempclass").attr("id", "clonediv" + counter);
$("#clonediv" + counter).removeClass("tempclass");
draggedNumber = ui.helper.attr('id').search(/drag([0-9])/)
itemDragged = "dragged" + RegExp.$1
$("#clonediv" + counter).addClass(itemDragged);
}
}
});
});
Below is the working code to rotate the image, but does not work for the discarded object
var counter = 1;
$(function() {
$('#test').live('mousedown', function(event) {
if ((counter > 0) && (counter < 350)) {
$('#test').rotate(counter + 45);
counter = counter + 45;
}
else if ((counter > -1) && (counter > 350)) {
counter = 1;
}
});
});
Any suggestion will help me continue.
thank
Vani source
share