案例:jQuery UI案例     状态:可编辑再运行    进入竖版
 运行结果 
AخA
    var recycle_icon = "<a href='link/to/recycle/script/when/we/have/js/off' title='还原图像' class='ui-icon ui-icon-refresh'>还原图像</a>";
 
1
<!doctype html>
2
<html lang="en">
3
<head>
4
  <meta charset="utf-8">
5
  <title>jQuery UI 放置(Droppable) - 简单的照片管理器</title>
6
  <link rel="stylesheet" href="/css/jqu1.10.4/jquery-ui.min.css">
7
  <script src="/js/jqu/jquery.min1.10.2.js"></script>
8
  <script src="/js/jqu/jquery-ui.min1.10.4.js"></script>
9
  <link rel="stylesheet" href="jqueryui/style.css">
10
  <style>
11
  #gallery { float: left; width: 65%; min-height: 12em; }
12
  .gallery.custom-state-active { background: #eee; }
13
  .gallery li { float: left; width: 96px; padding: 0.4em; margin: 0 0.4em 0.4em 0; text-align: center; }
14
  .gallery li h5 { margin: 0 0 0.4em; cursor: move; }
15
  .gallery li a { float: right; }
16
  .gallery li a.ui-icon-zoomin { float: left; }
17
  .gallery li img { width: 100%; cursor: move; }
18
 
19
  #trash { float: right; width: 32%; min-height: 18em; padding: 1%; }
20
  #trash h4 { line-height: 16px; margin: 0 0 0.4em; }
21
  #trash h4 .ui-icon { float: left; }
22
  #trash .gallery h5 { display: none; }
23
  </style>
24
  <script>
25
  $(function() {
26
    // 这是相册和回收站
27
    var $gallery = $( "#gallery" ),
28
      $trash = $( "#trash" );
29
 
30
    // 让相册的条目可拖拽
31
    $( "li", $gallery ).draggable({
32
      cancel: "a.ui-icon", // 点击一个图标不会启动拖拽
33
      revert: "invalid", // 当未被放置时,条目会还原回它的初始位置
34
      containment: "document",
35
      helper: "clone",
36
      cursor: "move"
37
    });
38
 
39
    // 让回收站可放置,接受相册的条目
40
    $trash.droppable({
41
      accept: "#gallery > li",
42
      activeClass: "ui-state-highlight",
43
      drop: function( event, ui ) {
44
        deleteImage( ui.draggable );
45
      }
46
    });
47
 
48
    // 让相册可放置,接受回收站的条目