start and stop events : UI Draggable « jQuery « JavaScript DHTML






start and stop events

 

<html lang="en">
<head>
  <title></title>
  <link type="text/css" href="js/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
  <script type="text/javascript" src="js/ui/ui.core.js"></script>
  <script type="text/javascript" src="js/ui/ui.draggable.js"></script>
  <link type="text/css" href="js/demos.css" rel="stylesheet" />
  <script type="text/javascript">
    $(function() {
      var dragOpts = {  
        start: setShadow,
        stop: unsetShadow
      };
      
      function setShadow() {
        $("#drag").css({ background: 'red', width:"120px", height:"121px" });
      }
      
      function unsetShadow() {
        $("#drag").css({ background: 'yellow', width:"114px", height:"114px" });
      }
    
    
      $("#drag").draggable(dragOpts);
    });
  </script>
</head>
<body>
    <div id="drag">Move me</div>

</body>
</html>

   
  








Related examples in the same category

1.jQuery UI Draggable - Constrain movement
2.jQuery UI Draggable - Cursor style
3.jQuery UI Draggable - Default functionality
4.jQuery UI Draggable - Delay start
5.jQuery UI Draggable - Events
6.jQuery UI Draggable - Handles
7.jQuery UI Draggable - Revert position
8.jQuery UI Draggable - Auto-scroll
9.jQuery UI Draggable - Snap to element or grid
10.jQuery UI Draggable + Sortable
11.jQuery UI Draggable - Visual feedback
12.Change cursor for draggable tag
13.Set cursor position for the draggable
14.Can only drag along with axis y
15.Drag delay
16.Drag along a grid
17.Add border to the draggable
18.Only draggable inside parent
19.Add dragging stopped event handler
20.revert: true (fly back)
21.Snap to another
22.Disable, enable and destroy the draggable object
23.Set the handles for all directions
24.Add knobHandles