why would draggable multiply everytime i move it? i took a picture to show you what i mean. this happens every time i move the helmet image resizing is no problem only when i drag the image here is my script only if you need more please feel free to ask thank you.
<script>// External added
jQuery(download).ready(function () {
jQuery(".file-upload-wrapper").hide();
jQuery(".out-put-img1").hide();
jQuery("#imajes45").change(function () {
var selected = jQuery('#imajes45').val();
if (selected == "new-upload") {
jQuery(".file-upload-wrapper").show();
} else {
jQuery(".file-upload-wrapper").hide();
}
});
//File
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
jQuery(".out-put-img1").show();
$('#output1').attr('src', e.target.result);
// / $('.append-img').append('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
jQuery("#upload-img1").change(function () {
readURL(this);
$(".samson").draggable();
$(".out-put-img1").resizable();
});
});
</script>
<script>
// External added
jQuery(download).ready(function () {
jQuery(".file-upload-wrapper1").hide();
jQuery(".out-put-img2").hide();
jQuery("#imajes45").change(function () {
var selected = jQuery('#imajes45').val();
if (selected == "new-upload") {
jQuery(".file-upload-wrapper1").show();
} else {
jQuery(".file-upload-wrapper1").hide();
}
});
//File
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
jQuery(".out-put-img2").show();
$('#output2').attr('src', e.target.result);
// / $('.append-img').append('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
jQuery("#upload-img2").change(function () {
readURL(this);
$(".dragbal1").draggable();
$(".out-put-img2").resizable();
});
});
</script>
<script>
// External added
jQuery(download).ready(function () {
jQuery(".file-upload-wrapper2").hide();
jQuery(".out-put-img4").hide();
jQuery("#imajes45").change(function () {
var selected = jQuery('#imajes45').val();
if (selected == "new-upload") {
jQuery(".file-upload-wrapper2").show();
} else {
jQuery(".file-upload-wrapper2").hide();
}
});
//File
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
jQuery(".out-put-img4").show();
$('#output4').attr('src', e.target.result);
// / $('.append-img').append('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
jQuery("#upload-img4").change(function () {
readURL(this);
$(".chinass2").draggable();
$(".out-put-img4").resizable();
});
});
</script>
Using the following Demo as a sort of Guide, you can make this work better:
http://jqueryui.com/droppable/#photo-manager
With the idea that the user would want to upload an image and then place it on the shirt, I created an upload preview first. This can then be dragged onto the target shirt. It then needs to be appended to
#boxes
, allowed to be dragged, and resized.Here is my working example: https://jsfiddle.net/Twisty/4ezggt9h/
HTML
CSS
JavaScript
This may generate more questions than answers. Hope it helps.