Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html5 vs jquery drag and drop

I'm starting the development of a webapp, I want to use HTML5 as much as I can. My application has an interface with a heavy use of drag and drop, my question is, at this moment, is it recommended to use the html5 native drag and drop? or is it better to use another js library for that like jquery ui?

Thanks in advance

Escobar

like image 529
Escobar5 Avatar asked Aug 03 '11 01:08

Escobar5


People also ask

Does HTML5 support drag-and-drop?

Complete HTML/CSS Course 2022 Now HTML 5 came up with a Drag and Drop (DnD) API that brings native DnD support to the browser making it much easier to code up. HTML 5 DnD is supported by all the major browsers like Chrome, Firefox 3.5 and Safari 4 etc.

Is drag-and-drop possible in HTML?

In HTML, any element can be dragged and dropped.

How do you drag-and-drop in jQuery?

Using jQuery UI, we can make the DOM(Document Object Model) elements to drag anywhere within the view port. This can be done by clicking on the draggable object by mouse and dragging it anywhere within the view port. If the value of this option is set to false, it will prevent the DOM elements to be dragged .

What is used to drag data in HTML5?

HTML drag-and-drop uses the DOM event model and drag events inherited from mouse events . A typical drag operation begins when a user selects a draggable element, drags the element to a droppable element, and then releases the dragged element.


1 Answers

HTML 5 is widely considered the next major step in web development and many browsers have begun the adoption of the new standard. So think of using HTML 5 to accomplish these tasks as an investment in future technologies. It will make your application more robust and more scalable.

Unfortunately HTML5 is still new and many browsers don't support (parts of) it. I suggest using HTML 5 and having the ability to fallback to Javascript if the browser doesn't support the feature.

Using Modernizr you can easily detect the feature like so

if(Modernizr.draganddrop) {
   // HTML 5!
} else {
   // Javascript fallback option
}
like image 169
tskuzzy Avatar answered Sep 17 '22 17:09

tskuzzy