User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,592 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,717 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 10477 | Replies: 9
Reply
Join Date: May 2005
Posts: 1
Reputation: oi@Sorenso is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
oi@Sorenso oi@Sorenso is offline Offline
Newbie Poster

Help Drag and Drop

  #1  
May 12th, 2005
Hello!

I need a script so that I can drag an object (picture) and drop it in
another object (ex: basket). When I do that, I want to run an action. Do
anyone know how I can do this... mabye some tutorial or code?

Thanks for all answers!!!!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2005
Location: Ottawa, Ontario, Canada
Posts: 959
Reputation: belama is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
belama's Avatar
belama belama is offline Offline
Posting Shark

Re: Drag and Drop

  #2  
May 12th, 2005
Add the these attibutes to divs and youll be able to drag and select controls and text.

<div contenteditable="true" indicateeditable="true"></div>
Reply With Quote  
Join Date: May 2005
Location: Wellington, New Zealand
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

Re: Drag and Drop

  #3  
May 12th, 2005
I found some good dragable layer code: http://www.howtocreate.co.uk/jslibs/

The code here allows you to create your own dhtml components that are moveable... I edited this code for my website: http://homepages.ihug.co.nz/~jlittle/index.html

But really drag and drop functionality is just drag functionality + knowing what the relationship is between objects.... if you can maintain a list of objects that have knowledge of their bounds... then you can use that implement drop functionality.
Reply With Quote  
Join Date: Mar 2005
Location: Ottawa, Ontario, Canada
Posts: 959
Reputation: belama is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
belama's Avatar
belama belama is offline Offline
Posting Shark

Re: Drag and Drop

  #4  
May 13th, 2005
http://www.walterzorn.com/dragdrop/dragdrop_e.htmThis one is worth looking at.
Check for yourself.
Reply With Quote  
Join Date: May 2005
Location: Wellington, New Zealand
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

Re: Drag and Drop

  #5  
May 14th, 2005
Originally Posted by belama
http://www.walterzorn.com/dragdrop/dragdrop_e.htmThis one is worth looking at.
Check for yourself.


I like it. Though I think it would take me a while to come up with a purpose for it
Reply With Quote  
Join Date: Aug 2005
Posts: 2
Reputation: sj669 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sj669 sj669 is offline Offline
Newbie Poster

Drag and Drop Re locate

  #6  
Aug 10th, 2005
Hi, I'm creating a calendar in open code using drag drop, so that people can drag a word likerevise into a box.

At the moment when you drag the word revise onto the calendar it will stay exactly where you leave it onmouseup, even if it is lying over two boxes on the calendar. Ideally what Is that if the word is more over a certain box onmouseup then it will relocate to that box.

this is like when playing solitair on windowsthe cards will snap to the correct place

Ideally this needs to all be in open code.

Thanks

SJ
Reply With Quote  
Join Date: May 2005
Location: Wellington, New Zealand
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

Re: Drag and Drop

  #7  
Aug 10th, 2005
Hi,

I could edit your code for you. And publish the source, however I would be asking for US$60 an hour.

The problem is a little tricky... but if you are able to move the text already, then you have implemented about 60% of the core. And you know where the mouseup event occured, hence you have a mechanism of working out where you should 'snap' to.

The next problem is the 'snap'. I'd say the easiest way is to assign a mouseup event to each calendar cell, so when mouseup occurs you capture it in the cell you should be snapped to.

Then you will be able to work out the X and Y co-ordinates of your cell. And then you can snap your text.

Hmmm... sounds easy now.
Reply With Quote  
Join Date: Aug 2005
Posts: 2
Reputation: sj669 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sj669 sj669 is offline Offline
Newbie Poster

Re: Drag and Drop

  #8  
Aug 24th, 2005
OK now my problem is that i want to save the position of the drag drop layers on the screen

If anyone wants to see what's been done already email sj669@homail.com and make the subject !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! and i will email you the code.

thanks

sj
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Drag and Drop

  #9  
Aug 24th, 2005
Save the values into cookies.
Reply With Quote  
Join Date: May 2005
Location: Wellington, New Zealand
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

Re: Drag and Drop

  #10  
Aug 24th, 2005
yup, cookies are a good idea...

I have seen another reasonably good idea (depending on the implementation/function of your site) and that is what is done with http://www.tiddlywiki.com/ the idea is that it is a wiki that you can save on a usb stick and carry where ever you go (with a computer). As opposed to a normal wiki that is every where you go with a good internet connection.

And you are perhaps more advanced than this, but this page contains a very nice drag and drop example http://script.aculo.us/
Last edited by alpha_foobar : Aug 24th, 2005 at 4:58 pm. Reason: grammar
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 11:25 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC