basic.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Basic Droppable - jQuery EasyUI Demo</title>
  6. <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="../demo.css">
  9. <script type="text/javascript" src="../../jquery.min.js"></script>
  10. <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
  11. </head>
  12. <body>
  13. <h2>Basic Droppable</h2>
  14. <div class="demo-info">
  15. <div class="demo-tip icon-tip"></div>
  16. <div>Drag the boxed on left to the target area on right.</div>
  17. </div>
  18. <div style="margin:10px 0;"></div>
  19. <div style="float:left;width:200px;margin-right:20px;">
  20. <div class="title">Source</div>
  21. <div>
  22. <div class="dragitem">Apple</div>
  23. <div class="dragitem">Peach</div>
  24. <div class="dragitem">Orange</div>
  25. </div>
  26. </div>
  27. <div style="float:left;width:200px;">
  28. <div class="title">Target</div>
  29. <div class="easyui-droppable targetarea"
  30. data-options="
  31. accept: '.dragitem',
  32. onDragEnter:function(e,source){
  33. $(this).html('enter');
  34. },
  35. onDragLeave: function(e,source){
  36. $(this).html('leave');
  37. },
  38. onDrop: function(e,source){
  39. $(this).html($(source).html() + ' dropped');
  40. }
  41. ">
  42. </div>
  43. </div>
  44. <div style="clear:both"></div>
  45. <style type="text/css">
  46. .title{
  47. margin-bottom:10px;
  48. }
  49. .dragitem{
  50. border:1px solid #ccc;
  51. width:50px;
  52. height:50px;
  53. margin-bottom:10px;
  54. }
  55. .targetarea{
  56. border:1px solid red;
  57. height:150px;
  58. }
  59. .proxy{
  60. border:1px solid #ccc;
  61. width:80px;
  62. background:#fafafa;
  63. }
  64. </style>
  65. <script>
  66. $(function(){
  67. $('.dragitem').draggable({
  68. revert:true,
  69. deltaX:10,
  70. deltaY:10,
  71. proxy:function(source){
  72. var n = $('<div class="proxy"></div>');
  73. n.html($(source).html()).appendTo('body');
  74. return n;
  75. }
  76. });
  77. });
  78. </script>
  79. </body>
  80. </html>