PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
It is currently Sun Jun 24, 2018 6:04 am

All times are UTC - 5 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Jul 09, 2012 4:13 pm 
Forum Contributor

Joined: Fri Dec 31, 2010 6:11 pm
Posts: 134
Hello, i'm using jquery draggable method to move an element to a new container. I want the original element to disappear once the dragging begins and have a clone of the original to be dragged instead. Then once is clone is dropped into droppable, I want the original to reappear in a third container and the clone to dissappear. I'm stuck at stage 1, (ie making the original to dissapar). Problem is, I don't know how to select the object representing the original. Here's what I've tried. I've also $(this).hide() in place of ui.draggable.hide(), but none of that works. Any ideas? Thanks.

Syntax: [ Download ] [ Hide ]

function drag(){

        $('#drag_box > img').draggable({//Elements to be dragged are image elements contained in #drag_box

                helper: 'clone',

                revert: true,

                dragStart: function(event, ui){

                        ui.draggable.hide();//This line is supposed to hide the original


        });//end draggable method


                accept: '#drag_box img',  

                drop: function(event, ui){

                        ui.helper.remove();//Removes the clone from the DOM


        });//end droppable method

}//End drag


PostPosted: Wed Jul 18, 2012 4:54 pm 
Forum Newbie

Joined: Sat Jul 14, 2012 4:35 pm
Posts: 18
can you send simple html code of what you want do ?
i guess the clone is display :none ; by deatult and than you do show () ,right? (dont forget you can use addClass and remove class its very usefull when you do css to #drag use add class and do #drag.vis {visibility:hidden;} and than change css to visibilty visible im not sure remove class will help to cancel the hidden but .css("visibility","visible"); should work
try to do $(this).css("visibility","hidden"); //it will change its css to hidden when you want another event change the css to visible .
.in same css you can add class for the close to be visiable than you hide object1 and make visible object2 .
hope it helps a little bit .

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours

Who is online

Users browsing this forum: Majestic-12 [Bot] and 7 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group