soulaymane123
Blue Team Operator
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
In this tutorial, we have an example of a source code for the Drag and Drop using jQuery Plugin. In this example, we need a jQuery plugin to have a function of drag and drop. We are going to use the draggable() function to move the selected element that we have in the web page.
You can also check the live demo of this simple tutorial, so you can get an idea and you can try this out, let's start coding.
⚙ Live Demo
Create Draggable UI Element
We have five examples element to be draggable on the web page.
Kindly copy and paste this link to the HEAD tag of your web page.
jQuery Draggable() Function
We are going to use the draggable() function with the corresponding ID of the image element that we have in the web page. Using this function we can drag and drop the image element in the web page.
Output
⚙ Live Demo
For the full source code, kindly click the "Download Code" button below.
Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.
Download
You can also check the live demo of this simple tutorial, so you can get an idea and you can try this out, let's start coding.
⚙ Live Demo
Create Draggable UI Element
We have five examples element to be draggable on the web page.
- <img
src
=
"1.png"
id
=
"image_drag_1"
class
=
"img-style"
/
>
- <img
src
=
"2.png"
id
=
"image_drag_2"
class
=
"img-style"
/
>
- <img
src
=
"3.png"
id
=
"image_drag_3"
class
=
"img-style"
/
>
- <img
src
=
"4.png"
id
=
"image_drag_4"
class
=
"img-style"
/
>
- <img
src
=
"5.png"
id
=
"image_drag_5"
class
=
"img-style"
/
>
Kindly copy and paste this link to the HEAD tag of your web page.
jQuery Draggable() Function
We are going to use the draggable() function with the corresponding ID of the image element that we have in the web page. Using this function we can drag and drop the image element in the web page.
- <
script>
- $(
function
(
)
{
- $(
"#image_drag_1"
)
.draggable
(
)
;
- }
)
;
- $(
function
(
)
{
- $(
"#image_drag_2"
)
.draggable
(
)
;
- }
)
;
- $(
function
(
)
{
- $(
"#image_drag_3"
)
.draggable
(
)
;
- }
)
;
- $(
function
(
)
{
- $(
"#image_drag_4"
)
.draggable
(
)
;
- }
)
;
- $(
function
(
)
{
- $(
"#image_drag_5"
)
.draggable
(
)
;
- }
)
;
- </
script>
Output

⚙ Live Demo
For the full source code, kindly click the "Download Code" button below.
Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.
Download
You must upgrade your account or reply in the thread to view the hidden content.