tags:

views:

215

answers:

6

Is there a way to just use html to make an item draggable? (not just classifying an element as draggable)

A: 

You will need to use Javascript for that.

Alan Haggai Alavi
+7  A: 

No, you'll need to use javascript.

jQuery is very popular javascript framework which does a lot of the heavy lifting for you. Here are the docs for their draggable component.

Kirschstein
+3  A: 

Nope Javascript. Have a look at JQuery.

James
+1  A: 

If you are happy using HTML5, then there is support for draggable elements, but it does still use javascript.

HTML5 adds a couple of extra events: ondragenter, ondrop and ondragover.

Here's an example page: http://ljouanneau.com/lab/html5/demodragdrop.html

Rich Bradshaw
I'm not familiar at all with javascript or jquery... so I'll have to learn it. But thanks for the example link!
natas
If you do go this way, I'm not sure about IE compatibility at the moment. This isn't using jQuery, it's a native way of doing things but only in modern browsers.
Rich Bradshaw
A: 

Thanks for all the helpful links and answers everyone!!!

natas
When you want to say "Thanks," do so in your original post (by editing and appending "Thanks" to it), or by adding a comment to the answers. Don't create an "answer" to say thanks :)
Jonathan Sampson
It's true - this isn't a forum, it's a question and a series of answers. Things get voted up and down, so conversations in this way end up out of order.
Rich Bradshaw
Duly noted, but what does it hurt to create an "answer" (except for the fact that it bugs mods)
natas
@Natas, It breaks the flow, ruins your participation statistics, and annoys more than mods - it falsely gives the impression of activity within a discussion. :)
Jonathan Sampson
Seems to me that you're the one one it bothers :)I think everyone else is pretty much done with the thread, so stop wasting my time if you please :)
natas
+2  A: 

Draggable Enlightenment


Unfortunately, HTML is a feeble presentational language which merely gives us the functionality to describe structure of text-based data in a document. It has no way of adding marvelous interactions such as 'draggability'.

Luckily, JavaScript allowed such interactions and it's widespread uptake in web browsers caused developers to rejoice! However browsers implemented JavaScript in a variety of ways, causing heartache and distress for debuggers and testers.

Alas, help is at hand. JavaScript frameworks have become the solution to the misery of inconsistent implementations and developers can again add interactions to their pages.

Arguably the finest of these frameworks goes by the name of jQuery and can be found here. Others go by the name of Prototype and Dojo.

Get to know one of them closely and draggable enlightenment will be yours.

Jon Winstanley