案例:jQuery UI案例     状态:可编辑再运行    进入竖版
 运行结果 
Aخ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
  #draggable, #draggable2 { width: 90px; height: 90px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
12
  #droppable, #droppable2 { width: 120px; height: 120px; padding: 0.5em; float: left; margin: 10px; }
13
  h3 { clear: left; }
14
  </style>
15
  <script>
16
  $(function() {
17
    $( "#draggable" ).draggable();
18
    $( "#droppable" ).droppable({
19
      hoverClass: "ui-state-hover",
20
      drop: function( event, ui ) {
21
        $( this )
22
          .addClass( "ui-state-highlight" )
23
          .find( "p" )
24
            .html( "Dropped!" );
25
      }
26
    });
27
 
28
    $( "#draggable2" ).draggable();
29
    $( "#droppable2" ).droppable({
30
      accept: "#draggable2",
31
      activeClass: "ui-state-default",
32
      drop: function( event, ui ) {
33
        $( this )
34
          .addClass( "ui-state-highlight" )
35
          .find( "p" )
36
            .html( "Dropped!" );
37
      }
38
    });
39
  });
40
  </script>
41
</head>
42
<body>
43
 
44
<h3>当悬停在 droppable 上时的反馈:</h3>
45
 
46
<div id="draggable" class="ui-widget-content">
47
  <p>请拖拽我到目标</p>
48
</div>