Drag Drop a Copy in Jquery

Posted on 2009-07-15
Last Modified: 2012-05-07
In this example:

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.

Open in new window

Question by:JayZeeBoy

Accepted Solution

SaWey earned 125 total points
ID: 24863240
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);



						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


Author Closing Comment

ID: 31603922
Suhweeeet!  Perfect!  Thank you!

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
gif banner animation loads randomly in mobile 3 82
jQuery Animation faster 5 42
JQuery serialize and unserialize 8 49
window.setInterval not firing 7 29
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now