Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1485
  • Last Modified:

Drag Drop a Copy in Jquery

In this example:
http://jqueryui.com/demos/droppable/#photo-manager

How would I make a copy of the photos when drag starts?  I want to drag a clone of the original item, leaving the original item in its place.  I do not want the picture to be deleted when moved to the 'trash' in other words.
See http://jqueryui.com/demos/droppable/#photo-manager

Open in new window

0
JayZeeBoy
Asked:
JayZeeBoy
1 Solution
 
SaWeyCommented:
You can use something like this:
// image deletion function
				var recycle_icon = '<a href="link/to/recycle/script/when/we/have/js/off" title="Recycle this image" class="ui-icon ui-icon-refresh">Recycle image</a>';
				function deleteImage($item) {
						var $list = $('ul',$trash).length ? $('ul',$trash) : $('<ul class="gallery ui-helper-reset"/>').appendTo($trash);
 
						$item.find('a.ui-icon-trash').remove();
						var copy = $item.append(recycle_icon).clone();
						copy.appendTo($list).fadeIn(function() {
							copy.animate({ width: '48px' }).find('img').animate({ height: '36px' });
						});
				}

Open in new window

0
 
JayZeeBoyAuthor Commented:
Suhweeeet!  Perfect!  Thank you!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now