It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

How to drag and drop??

How to drag and drop??

Postby paulf on Sun Apr 06, 2008 10:02 pm

Hi all ... I am tring to drag and drop text but cannot find any reference to how to do it in any book or online tutorial. Any idea's were to look??

Also I will be looking for code that can evaluate the position of the drop and act according to its drop pos. Any suggestions were to find this also. Thanks
paulf
 
Posts: 12
Joined: Sat May 19, 2007 9:58 am

Postby rangana on Mon Apr 07, 2008 1:40 am

See this link
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Postby nottRobin on Tue Apr 08, 2008 9:36 am

The different browser models handle dragging and dropping very differently, and it's quite complicated in any case (involves reading the position of the mouse from the event, re-setting the absolute position of the element each time this changes etc.).

I would suggest you're far better off using a library that covers this for you. jQuery is extremely popular. They have "draggables" and "dropables" plugins: http://docs.jquery.com/UI - although I have never used them and there doesn't seem to be a tutorial.

If you're quite comfortable with OO principles within JavaScript you might try the mooTools drag object: http://docs.mootools.net/Drag/Drag-Base.js

Other libraries that might have stuff you want to look at:
Dojo: http://dojotoolkit.org/book/dojo-book-0 ... g-and-drop
Ext 2.0: http://extjs.com/learn/Tutorial:Custom_ ... rop_Part_1

Let me know how you get on as I've never used any of these, and someday I'm sure I'll want to do some of this and want to know what the best tools are.

Ta,
Robin.
nottRobin
 
Posts: 3
Joined: Fri Apr 04, 2008 9:22 am

Postby paulf on Tue Apr 08, 2008 4:32 pm

thanks to you both I think I have enough info to achieve what I need to now. Cheers!!
paulf
 
Posts: 12
Joined: Sat May 19, 2007 9:58 am

Postby rangana on Wed Apr 09, 2008 12:39 am

I believe that I am talking with nottRobin when I say, You're welcome ;)

...Glad to help :)
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Postby nottRobin on Wed Apr 09, 2008 8:10 am

Yep :) always a pleasure.
nottRobin
 
Posts: 3
Joined: Fri Apr 04, 2008 9:22 am


Who is online

Users browsing this forum: No registered users and 3 guests