HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
This tutorial shows you how to make an HTML element draggable, in this case, we will create three DIV elements and enable them to drag and drop.
First, we create three <div> element:
<Div id = "dd1" class = "dd-demo"> </ div> <Div id = "dd2" class = "dd-demo"> </ div> <Div id = "dd3" class = "dd-demo"> </ div>
For the first <div> element, we can let drag by default.
$ ( '# Dd1') draggable ().;
For the second <div> element, we create a clone (clone) of the original elements of the agent (proxy) can be allowed to drag.
$ ( '# Dd2'). Draggable ({ proxy: 'clone' });
For the third <div> element, we create a custom proxy (proxy) can be allowed to drag.
$ ( '# Dd3'). Draggable ({ proxy: function (source) { var p = $ ( '<div class = "proxy"> proxy </ div>'); p.appendTo ( 'body'); return p; } });