troubleshooting Question

jquery - changing source of clone

Avatar of Mamarazzi
MamarazziFlag for Sweden asked on
9 Comments1 Solution731 ViewsLast Modified:
I am new to jquery and I have created a drag-and drop function that copies small images from one area to antoher and also mkaes an insert in a database table. All is fine except for one detail that I cannot figure out.
I have two versions of each image (and the images represent data in the database), one thumb version (60 x 60 px)and one larger (140 x 140 px).

In the draggable area there are small images and in the droppable large ones. I want the image to change frpm small to large when i append them without doing a page reload.

I can either use the same image and change width and height or use two different image files. It doesn't matter, what ever is easiest to handle

Any ideas?
//Drag and drop from minlista to program part
	$(function() {	
		$("#minlista .thumb").draggable({
			helper: 'clone',
			opacity: 0.6, 
			cursor: 'move'

		   tolerance: 'touch',   
		   accept: '#minlista .thumb',
		   drop: function(ev, ui){
			  var id =  ui.draggable.find("img").attr("id");
			  var pp_id = $(this).find("div").attr("id");
			  var add_exc = '&exc_id=' + id + '&program_part_id='+ pp_id +'&action=addExcToPart';
			  $.post("updateDB.php", add_exc); 

Open in new window


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros