fmpq.com
源代码:
点击运行
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI 拖动(Draggable) - 视觉反馈</title> <link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css"> <script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script> <script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <link rel="stylesheet" href="jqueryui/style.css"> <style> #draggable, #draggable2, #draggable3, #set div { width: 90px; height: 90px; padding: 0.5em; float: left; margin: 0 10px 10px 0; } #draggable, #draggable2, #draggable3 { margin-bottom:20px; } #set { clear:both; float:left; width: 368px; height: 120px; } p { clear:both; margin:0; padding:1em 0; } </style> <script> $(function() { $( "#draggable" ).draggable({ helper: "original" }); $( "#draggable2" ).draggable({ opacity: 0.7, helper: "clone" }); $( "#draggable3" ).draggable({ cursor: "move", cursorAt: { top: -12, left: -20 }, helper: function( event ) { return $( "<div class='ui-widget-header'>I'm a custom helper</div>" ); } }); $( "#set div" ).draggable({ stack: "#set div" }); }); </script> </head> <body> <h3 class="docs">助手:</h3> <div id="draggable" class="ui-widget-content"> <p>原始的</p> </div> <div id="draggable2" class="ui-widget-content"> <p>半透明的克隆</p> </div> <div id="draggable3" class="ui-widget-content"> <p>自定义助手(与 cursorAt 结合)</p> </div> <h3 class="docs">堆叠:</h3> <div id="set"> <div class="ui-widget-content"> <p>我们是 draggables..</p> </div> <div class="ui-widget-content"> <p>..它的 z-index 是自动控制的..</p> </div> <div class="ui-widget-content"> <p>..带有 stack 选项。</p> </div> </div> </body> </html>
运行结果