I have created a drag n drop file in which the user will enter the coordinates like 3*4 when the dropped element is clicked,using scalar factor I get height and width for the element.I want to change the height and width of the dropped element. Can anyone help? Is there any way to change the size of the ui.helper element.
$(document).ready(function() {
var x = null;
//Make element draggable
$(".drag").draggable({
helper: 'clone',
cursor: 'move',
tolerance: 'fit'
});
var i = 1,
j = 0;
var x1, x2, y1, y2, tmp, tmp2;
var sf = pf;
$("#droppable").droppable({
drop: function(e, ui) {
var attr = ui.helper.attr('id');
if (typeof attr == typeof undefined || attr == false) {
ui.helper.attr('id', "id" + i);
}
tmp = ui.helper.attr('id');
x = ui.helper.clone().bind("click", 'img', function() {
alert("clicked" + ui.helper.attr('id') + tmp);
leftpos = ui.offset.left - 210;
toppos = ui.offset.top;
var cor = window.prompt("Enter coordinates x1,y1");
var c = cor.split(',');
var w = c[0] * sf;
var h = c[1] * sf;
w = w / 2;
h = h / 2;
ui.helper.width(leftpos - w);
ui.helper.height(toppos - h);
});
x.draggable({
helper: 'original',
containment: '#droppable',
tolerance: 'fit',
});
x.appendTo('#droppable');
ui.helper.remove();
i++;
}
});
});