Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

EasyUI jQuery Draggable widget

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

In this article, we will learn how to design a draggable widget using jQuery EasyUI. EasyUI is an HTML5 framework for using user interface components based on jQuery, React, Angular, and Vue technologies. It helps in building features for interactive web and mobile applications saving a lot of time for developers.

The widget creates a draggable element from markup or selector.

Download EasyUI for jQuery:


var a = $(".selector").draggable({


  • proxy: It is of type string or function. A proxy element to be used to set the ‘clone’. A clone element is used as a proxy. If a function is specified, it must return a jQuery object.
  • revert: It is of type boolean. The element will return to its starting position when the dragging stops.
  • cursor: It is of type string. The CSS cursor to be displayed when dragging.
  • delta X: It is of type number. The dragged element position x corresponding to the current cursor.
  • delta Y: It is of type number. The dragged element position y corresponding to the current cursor.
  • handle: It’s type is a selector. The handle that starts the draggable.
  • disabled: It’s type is boolean. If it’s set to true, the draggable feature will be disabled.
  • edge: It’s type is number. The width of the drag which can be used to start the draggable property.
  • axis: It’s type is a string. It sets the axis on which the dragged elements move on.
  • delay: It’s type is a delay. It defines the delay in time in milliseconds.


  • onBeforeDrag: The parameter is an event. It fires before dragging.
  • onStartDrag: The parameter is an event. It fires when the object starts dragging.
  • onDrag: The parameter is an event. It fires during dragging.
  • onEndDrag: The parameter is an event. It fires when the dragging end.
  • onStopDrag: The parameter is an event. It fires when the dragging stops.


  • options: It returns the options property.
  • Proxy: If the proxy property is set, it returns the drag proxy.
  • Enable: It enables the drag action.
  • disable: It disables the drag action.

Note: In the following examples only a few examples are shown, the developer can try out other properties, events, and methods listed above as per the application’s requirement.

CDN Links: First, add jQuery Easy UI scripts needed for your project.

<script type=”text/javascript” src=”jquery.min.js”></script>   
<!–jQuery libraries of EasyUI –> 
<script type=”text/javascript” src=”jquery.easyui.min.js”></script>   
<!–jQuery library of EasyUI Mobile –> 
<script type=”text/javascript” src=””></script>  

Example: The following example demonstrates jQuery EasyUI Draggable widget.


<!DOCTYPE html>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="initial-scale=1.0, maximum-scale=1.0,
    <!-- EasyUI specific stylesheets-->
    <link rel="stylesheet" type="text/css"
    <link rel="stylesheet" type="text/css"
    <link rel="stylesheet" type="text/css"
    <!--jQuery library -->
    <script type="text/javascript" src="jquery.min.js">
    <!--jQuery libraries of EasyUI -->
    <script type="text/javascript"
    <!--jQuery library of EasyUI Mobile -->
    <script type="text/javascript"
    <script type="text/javascript">
        $(document).ready(function (){
        $(document).ready(function (){
                cursor: 'pointer',
                revert: 'true'
    <h3>EasyUI Draggable Widget</h3>
    <div id="gfg">
        <div id="drag"
             style="background:rgb(199, 199, 199);
                    width: 180px;">
<p>Revert Draggable Element
    <div id="gfg1">
        <div id="drag1"
             style="background:rgb(199, 199, 199);
                    width: 180px;">
<p>Draggable Element



My Personal Notes arrow_drop_up
Last Updated : 12 Dec, 2021
Like Article
Save Article
Similar Reads