Log in

View Full Version : drag and drop



radiofriendlybox
03-08-2008, 01:36 AM
i've been googling all day, but haven't found exactly what i was looking for.

i'm searching for a script that allows me to drag elements around the screen (like an image, div, etc.). i want the element to return to its original position if it is not dropped in the correct place (let's say another div). if it is dropped in the correct place, something happens (like a new window opening).

so far, i've found scripts that let me drag items. i've found scripts that let me drop items in specific places. i even figured out how to get a new window opened when the element is dropped in the right place.

but i can't find a script where i can do this with multiple draggable elements, each with its own drop partner (eg, divA can only be dropped in divB otherwise it returns to its original spot; divC can only be dropped in divD otherwise it returns... and so on).

the closest thing i found was this: http://developer.yahoo.com/yui/examples/dragdrop/dd-circle.html

any help would be appreciated!

Medyman
03-08-2008, 02:39 AM
You can do it in Flash, quite easily.

radiofriendlybox
03-08-2008, 03:35 AM
You can do it in Flash, quite easily.

yes, i got that notion during my google searches. but the site i'm building is all css and javascript. just trying to keep it that way. flash would be my last resort. plus, i know less about flash than i do about javascript! :) thanks.

tech_support
03-08-2008, 09:54 AM
Mootools would do the job fairly well.

radiofriendlybox
03-10-2008, 06:21 PM
Mootools would do the job fairly well.

i'll have to play around with this to see what i can come up with. but that's a great site. thanks!

Felix Riesterer
03-12-2008, 08:09 PM
I have created such a function for my interactive quiz script framework which allows to create interactive learning quizzes. In some of such quizzes a drag&drop functionality is needed. Take a look!

Framework For Interactive Learning Quizzes (http://www.felix-riesterer.de/main/seiten/quizze_en.html)

Although my site is mostly in German I can provide you with help in English.

Have fun!

Felix Riesterer.

tfit
03-13-2008, 12:09 PM
This will do it:

http://education.qld.gov.au/virtualschool/html/students/infohub/virtual_quiz.htm
but it's not crosss platforn FF2 doesn't work.

Felix Riesterer
03-24-2008, 02:18 AM
This will do it:

http://education.qld.gov.au/virtualschool/html/students/infohub/virtual_quiz.htm
but it's not crosss platforn FF2 doesn't work.

No, even worse than that! Unless you want your page to be usable exclusively in Internet Explorer, you'll have to use a different script. In my opinion the first is the worst possible choice!

Use my framework and everything will work out-of-the-box! I can offer you help if you have trouble with the German CSS class names. But mind this: <body onload="do_something()"> means "do_something()" will run exclusively and will break other scripts that also try to run onLoad but attempt to do so unobtrusively (like Lightbox does - as well as my framework)!

Felix Riesterer.