Solved

Drag Drop a Copy in Jquery

Posted on 2009-07-15
2
1,472 Views
Last Modified: 2012-05-07
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
Comment
Question by:JayZeeBoy
2 Comments
 
LVL 2

Accepted Solution

by:
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);
 
						$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
 

Author Closing Comment

by:JayZeeBoy
ID: 31603922
Suhweeeet!  Perfect!  Thank you!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

770 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