实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
AخA
 
1
<!doctype html>
2
<html lang="en">
3
<head>
4
  <meta charset="utf-8">
5
  <title>jQuery UI 拖动(Draggable) - 光标样式</title>
6
  <link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
7
  <script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
8
  <script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
9
  <link rel="stylesheet" href="jqueryui/style.css">
10
  <style>
11
  #draggable, #draggable2, #draggable3 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
12
  </style>
13
  <script>
14
  $(function() {
15
    $( "#draggable" ).draggable({ cursor: "move", cursorAt: { top: 56, left: 56 } });
16
    $( "#draggable2" ).draggable({ cursor: "crosshair", cursorAt: { top: -5, left: -5 } });
17
    $( "#draggable3" ).draggable({ cursorAt: { bottom: 0 } });
18
  });
19
  </script>
20
</head>
21
<body>
22
 
23
<div id="draggable" class="ui-widget-content">
24
  <p>我总是在中间(相对于鼠标)</p>
25
</div>
26
 
27
<div id="draggable2" class="ui-widget-content">
28
  <p>我的光标是在 left -5 和 top -5</p>
29
</div>
30
 
31
<div id="draggable3" class="ui-widget-content">
32
  <p>我的光标位置只控制了 'bottom' 值</p>
33
</div>
34
 
35
 
36
</body>
37
</html>