5 <title>jQuery UI Droppable - Revert draggable position</title>
6 <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
7 <script src="../../jquery-1.9.1.js"></script>
8 <script src="../../ui/jquery.ui.core.js"></script>
9 <script src="../../ui/jquery.ui.widget.js"></script>
10 <script src="../../ui/jquery.ui.mouse.js"></script>
11 <script src="../../ui/jquery.ui.draggable.js"></script>
12 <script src="../../ui/jquery.ui.droppable.js"></script>
13 <link rel="stylesheet" href="../demos.css">
15 #draggable, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
16 #droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; }
20 $( "#draggable" ).draggable({ revert: "valid" });
21 $( "#draggable2" ).draggable({ revert: "invalid" });
23 $( "#droppable" ).droppable({
24 activeClass: "ui-state-hover",
25 hoverClass: "ui-state-active",
26 drop: function( event, ui ) {
28 .addClass( "ui-state-highlight" )
38 <div id="draggable" class="ui-widget-content">
39 <p>I revert when I'm dropped</p>
42 <div id="draggable2" class="ui-widget-content">
43 <p>I revert when I'm not dropped</p>
46 <div id="droppable" class="ui-widget-header">
50 <div class="demo-description">
51 <p>Return the draggable (or it's helper) to its original location when dragging stops with the boolean <code>revert</code> option set on the draggable.</p>