is it possible to change the properties of an element once its been
dropped into another div?
for example:
lets say i have a div (#droppable_images) that contains a bunch of
icons and i want to drag and drop them onto another div
(#droppable_area)
images withing the #droppable_area are draggable but are confined to
the div too allow users to arrange images as they please. images
within #droppable_images obviously need to be draggable with a clone
helper so the user can see where theyre dragging to.
once the image from #droppable_images is dragged and dropped onto
#droppable_area i want its characteristics to change so that it
becomes a draggable image with containment: "parent" like the rest of
the images in the div.
heres what i have so far but it doesnt seem to work:
$(document).ready(function() {
---- // all images already in #droppable_area are draggable and
confined to the parent
---- $("#board > img").draggable({
-------- containment: "parent",
---- });
---- // images in #droppable_images need to be draggable with a
helper: "clone"
---- $("#picker > img").draggable({
-------- helper: "clone"
---- });
---- // the #droppable_area needs to set up to receive images from
#droppable_images
---- $("#droppable_area").droppable({
-------- accept: "#droppable_images > img",
-------- activeClass: "droppable-active",
-------- hoverClass: "droppable-hover",
-------- // drop function
-------- drop: function(e, ui) {
------------ // first attach the image to the #droppable_area - ???
------------ $(this).append($(ui.draggable));
------------ // then reset all images in #droppable_area so new ones
have the right properties - ???
------------ $("#droppable_area > img").draggable({
---------------- containment: "parent",
------------ });
-------- }
---- });
});
(sorry for all the dashes, i was the only way i could figure out how
to maintain my code structure)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---