drag

Triggered while the mouse is moved during the dragging, immediately before the current move happens.

Parameters

NameTypeDescription
e {object} event data
newPosition {object} New position of the draggable element as { top, left } object.
mousePosition {object} Current mouse position as { x, y } object.

Examples

sample

    
 <style>
 .element { border: 1px solid #999; width: 300px; height: 200px; cursor: move; text-align: center; background-color: #DDD; }
 </style>
 <div id="element" class="element gj-unselectable">drag me</div>
 <script>
     $('#element').draggable({
         drag: function (e, newPosition, mousePosition) {
             $('body').append('<div>The drag event is fired. New Element Position = { top:' + newPosition.top + ', left: ' + newPosition.left + '}.</div>');
         }
     });
 </script>