default.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>jQuery UI Droppable - Default functionality</title>
  6. <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
  7. <script src="../../jquery-1.10.2.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">
  14. <style>
  15. #draggable { 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; }
  17. </style>
  18. <script>
  19. $(function() {
  20. $( "#draggable" ).draggable();
  21. $( "#droppable" ).droppable({
  22. drop: function( event, ui ) {
  23. $( this )
  24. .addClass( "ui-state-highlight" )
  25. .find( "p" )
  26. .html( "Dropped!" );
  27. }
  28. });
  29. });
  30. </script>
  31. </head>
  32. <body>
  33. <div id="draggable" class="ui-widget-content">
  34. <p>Drag me to my target</p>
  35. </div>
  36. <div id="droppable" class="ui-widget-header">
  37. <p>Drop here</p>
  38. </div>
  39. <div class="demo-description">
  40. <p>Enable any DOM element to be droppable, a target for draggable elements.</p>
  41. </div>
  42. </body>
  43. </html>