{"id":3023,"date":"2023-11-14T15:02:33","date_gmt":"2023-11-14T07:02:33","guid":{"rendered":""},"modified":"2023-11-14T15:02:33","modified_gmt":"2023-11-14T07:02:33","slug":"jQuery UI Draggable","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/3023.html","title":{"rendered":"jQuery UI Draggable"},"content":{"rendered":"
\n

jQuery UI Draggable<\/h1>\n<\/div>\n
\n jQuery UI draggable()\u65b9\u6cd5\u7528\u4e8e\u4f7f\u4efb\u4f55DOM\u5143\u7d20\u53ef\u62d6\u52a8\u3002\u5c06\u5143\u7d20\u8bbe\u7f6e\u4e3a\u53ef\u62d6\u52a8\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u5355\u51fb\u9f20\u6807\u5c06\u5176\u79fb\u52a8\u5e76\u5c06\u5176\u62d6\u52a8\u5230\u89c6\u53e3\u5185\u7684\u4efb\u610f\u4f4d\u7f6e\u3002\n<\/div>\n
\n \u8bed\u6cd5: <\/strong>\n<\/div>\n
\n \u60a8\u53ef\u4ee5\u4e24\u79cd\u5f62\u5f0f\u4f7f\u7528draggable()\u65b9\u6cd5:\n<\/div>\n
\n
 1. $(selector, context).draggable (options) \u65b9\u6cd5
<\/span><\/code><\/pre>\n<\/div>\n
\n
 2. $(selector, context).draggable (\"action\", params) \u65b9\u6cd5 
<\/span><\/code><\/pre>\n<\/div>\n

$(selector, context).draggable (options) \u65b9\u6cd5<\/h2>\n
\n draggable(options)\u65b9\u6cd5\u6307\u5b9a\u53ef\u4ee5\u5728HTML\u9875\u9762\u4e2d\u79fb\u52a8HTML\u5143\u7d20\u3002\u5728\u8fd9\u91cc\uff0coption\u53c2\u6570\u6307\u5b9a\u4e86\u6240\u6d89\u53ca\u5143\u7d20\u7684\u884c\u4e3a\u3002\n<\/div>\n
\n \u8bed\u6cd5: <\/strong>\n<\/div>\n
\n
 $(selector, context).draggable(options);
<\/span><\/code><\/pre>\n<\/div>\n
\n \u60a8\u53ef\u4ee5\u4f7f\u7528JavaScript\u5bf9\u8c61\u540c\u65f6\u4f7f\u7528\u4e00\u4e2a\u6216\u591a\u4e2a\u9009\u9879\u3002\u5982\u679c\u6709\u591a\u4e2a\u9009\u9879\uff0c\u5219\u5e94\u4f7f\u7528\u9017\u53f7\u5206\u9694\u3002\u4f8b\u5982:\n<\/div>\n
\n
 $(selector, context).draggable({option1: value1, option2: value2..... }); 
<\/span><\/code><\/pre>\n<\/div>\n
\n \u4ee5\u4e0b\u662f\u53ef\u4e0e\u8be5\u65b9\u6cd5\u4e00\u8d77\u4f7f\u7528\u7684\u4e0d\u540c\u9009\u9879\u7684\u5217\u8868:\n<\/div>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u9009\u9879<\/td>\n\u8bf4\u660e<\/td>\n<\/tr>\n
addclasses <\/td>\n\u5982\u679c\u6b64\u9009\u9879\u8bbe\u7f6e\u4e3afalse\uff0c\u5c06\u9632\u6b62\u5c06UI\u53ef\u62d6\u52a8\u7c7b\u6dfb\u52a0\u5230\u6240\u9009DOM\u5143\u7d20\u5217\u8868\u4e2d\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3atrue\u3002<\/td>\n<\/tr>\n
appendto<\/td>\n\u5b83\u6307\u5b9a\u5728\u62d6\u52a8\u65f6\u5e94\u5c06\u53ef\u62d6\u52a8\u5e2e\u52a9\u7a0b\u5e8f\u9644\u52a0\u5230\u7684\u5143\u7d20\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\"\u7236\u7ea7\"\u3002<\/td>\n<\/tr>\n
axis<\/td>\n\u6b64\u9009\u9879\u53ef\u9650\u5236\u62d6\u52a8\u5230\u6c34\u5e73(x)\u6216\u5782\u76f4(y)\u8f74\u3002\u5176\u53ef\u80fd\u7684\u503c\u4e3a: \" x\"\uff0c\" y\"\u3002<\/td>\n<\/tr>\n
cancel<\/td>\n\u6b64\u9009\u9879\u7528\u4e8e\u9632\u6b62\u5728\u6307\u5b9a\u5143\u7d20\u4e0a\u5f00\u59cb\u62d6\u52a8\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\"\u8f93\u5165\uff0c\u6587\u672c\u533a\u57df\uff0c\u6309\u94ae\uff0c\u9009\u62e9\uff0c\u9009\u9879\"\u3002<\/td>\n<\/tr>\n
connecttosortable <\/td>\n\u6b64\u9009\u9879\u7528\u4e8e\u6307\u5b9a\u5176\u5143\u7d20\u53ef\u4e92\u6362\u7684\u5217\u8868\u3002\u5728\u653e\u7f6e\u7684\u672b\u5c3e\uff0c\u5143\u7d20\u662f\u5217\u8868\u7684\u4e00\u90e8\u5206\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
containment<\/td>\n\u5c06\u62d6\u52a8\u9650\u5236\u5728\u6307\u5b9a\u5143\u7d20\u6216\u533a\u57df\u7684\u8303\u56f4\u5185\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
cursor<\/td>\n\u7528\u4e8e\u5728\u5143\u7d20\u79fb\u52a8\u65f6\u6307\u5b9a\u5149\u6807\u7684CSS\u5c5e\u6027\u3002\u5b83\u4ee3\u8868\u9f20\u6807\u6307\u9488\u7684\u5f62\u72b6\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\"\u81ea\u52a8\"\u3002<\/td>\n<\/tr>\n
cursorat <\/td>\n\u5b83\u8bbe\u7f6e\u62d6\u52a8\u52a9\u624b\u76f8\u5bf9\u4e8e\u9f20\u6807\u5149\u6807\u7684\u504f\u79fb\u91cf\u3002\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u6216\u4e24\u4e2a\u952e\u7684\u7ec4\u5408\u5c06\u5750\u6807\u4f5c\u4e3a\u54c8\u5e0c\u503c\u7ed9\u51fa: {top\uff0cleft\uff0cright\uff0cbottom}\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
delay<\/td>\n\u5b83\u6307\u5b9a\u4e86\u5ef6\u8fdf(\u4ee5\u6beb\u79d2\u4e3a\u5355\u4f4d)\uff0c\u5728\u6b64\u4e4b\u540e\u8003\u8651\u4e86\u9f20\u6807\u7684\u7b2c\u4e00\u6b21\u79fb\u52a8\u3002\u4f4d\u79fb\u53ef\u80fd\u5728\u90a3\u4e4b\u540e\u5f00\u59cb\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" 0\"\u3002<\/td>\n<\/tr>\n
disabled<\/td>\n\u8bbe\u7f6e\u4e3atrue\u65f6\uff0c\u5b83\u5c06\u7981\u7528\u79fb\u52a8\u9879\u76ee\u7684\u529f\u80fd\u3002\u5728\u542f\u7528\u6b64\u529f\u80fd\u4e4b\u524d(\u4f7f\u7528\u53ef\u62d6\u52a8(\"\u542f\u7528\")\u6307\u4ee4)\uff0c\u65e0\u6cd5\u79fb\u52a8\u9879\u76ee\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
distance<\/td>\n\u5728\u8003\u8651\u4f4d\u79fb\u4e4b\u524d\u5fc5\u987b\u79fb\u52a8\u9f20\u6807\u7684\u50cf\u7d20\u6570\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" 1\"\u3002<\/td>\n<\/tr>\n
grid<\/td>\n\u5b83\u5c06\u62d6\u52a8\u8f85\u52a9\u5bf9\u8c61\u6355\u6349\u5230\u6bcf\u4e2ax\u548cy\u50cf\u7d20\u7684\u7f51\u683c\u3002\u6570\u7ec4\u7684\u683c\u5f0f\u5fc5\u987b\u4e3a[x\uff0cy]\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
handle<\/td>\n\u5982\u679c\u6307\u5b9a\uff0c\u5219\u9650\u5236\u4ece\u5f00\u59cb\u62d6\u52a8\uff0c\u9664\u975e\u5728\u6307\u5b9a\u5143\u7d20\u4e0a\u53d1\u751f\u9f20\u6807\u6309\u4e0b\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
helper <\/td>\n\u5b83\u5141\u8bb8\u5c06\u8f85\u52a9\u5143\u7d20\u7528\u4e8e\u62d6\u52a8\u663e\u793a\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\"\u539f\u59cb\"\u3002<\/td>\n<\/tr>\n
iframefix <\/td>\n\u5b83\u53ef\u4ee5\u9632\u6b62iframe\u5728\u62d6\u52a8\u8fc7\u7a0b\u4e2d\u6355\u83b7mousemove\u4e8b\u4ef6\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
opacity<\/td>\n\u79fb\u52a8\u65f6\u5143\u7d20\u79fb\u52a8\u7684\u4e0d\u900f\u660e\u5ea6\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
refreshpositions<\/td>\n\u5982\u679c\u8bbe\u7f6e\u4e3atrue\uff0c\u5219\u6bcf\u6b21\u9f20\u6807\u79fb\u52a8\u90fd\u4f1a\u8ba1\u7b97\u6240\u6709\u53ef\u653e\u7f6e\u4f4d\u7f6e\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
revert<\/td>\n\u5b83\u6307\u793a\u5143\u7d20\u5728\u79fb\u52a8\u7ed3\u675f\u65f6\u662f\u5426\u79fb\u56de\u5230\u5176\u539f\u59cb\u4f4d\u7f6e\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
revertduration<\/td>\n\u5b83\u6307\u793a\u4f4d\u79fb\u7684\u6301\u7eed\u65f6\u95f4(\u4ee5\u6beb\u79d2\u4e3a\u5355\u4f4d)\uff0c\u4e4b\u540e\u5143\u7d20\u5c06\u8fd4\u56de\u5230\u5176\u539f\u59cb\u4f4d\u7f6e(\u8bf7\u53c2\u9605options.revert)\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" 500\"\u3002<\/td>\n<\/tr>\n
scope <\/td>\n\u9664\u4e86droppable\u7684accept\u9009\u9879\u4e4b\u5916\uff0c\u5b83\u8fd8\u7528\u4e8e\u5c06\u53ef\u62d6\u52a8\u548c\u53ef\u62d6\u653e\u9879\u76ee\u96c6\u8fdb\u884c\u5206\u7ec4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\"\u9ed8\u8ba4\"\u3002<\/td>\n<\/tr>\n
scroll<\/td>\n\u5f53\u8bbe\u7f6e\u4e3atrue(\u9ed8\u8ba4\u503c)\u65f6\uff0c\u5982\u679c\u5c06\u9879\u76ee\u79fb\u5230\u7a97\u53e3\u7684\u53ef\u89c6\u533a\u57df\u4e4b\u5916\uff0c\u5219\u663e\u793a\u5c4f\u5c06\u6eda\u52a8\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" true\"\u3002<\/td>\n<\/tr>\n
scrollsenstivity<\/td>\n\u5b83\u6307\u793a\u9f20\u6807\u5fc5\u987b\u79bb\u5f00\u7a97\u53e3\u591a\u5c11\u50cf\u7d20\u624d\u80fd\u5f15\u8d77\u6eda\u52a8\u663e\u793a\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" 20\"\u3002<\/td>\n<\/tr>\n
scrollspeed <\/td>\n\u5b83\u6307\u793a\u6eda\u52a8\u5f00\u59cb\u540e\u663e\u793a\u5c4f\u7684\u6eda\u52a8\u901f\u5ea6\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" 20\"\u3002<\/td>\n<\/tr>\n
snap<\/td>\n\u5b83\u8c03\u6574\u6b63\u5728\u5176\u4ed6\u5143\u7d20(\u98de\u884c\u7684)\u4e0a\u79fb\u52a8\u7684\u9879\u76ee\u7684\u663e\u793a\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
snapmode <\/td>\n\u5b83\u6307\u5b9a\u5982\u4f55\u5728\u79fb\u52a8\u7684\u5143\u7d20\u548coptions.snap\u4e2d\u6307\u793a\u7684\u5143\u7d20\u4e4b\u95f4\u8fdb\u884c\u8c03\u6574\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" both\"\u3002<\/td>\n<\/tr>\n
snaptolerance <\/td>\n\u5b83\u6307\u5b9a\u5efa\u7acb\u8c03\u6574\u6240\u9700\u7684\u4f4d\u7f6e\u5dee\u5f02\u4e2d\u7684\u6700\u5927\u50cf\u7d20\u6570\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" 20\"\u3002<\/td>\n<\/tr>\n
stack <\/td>\n\u5b83\u63a7\u5236\u4e0e\u9009\u62e9\u5668\u5339\u914d\u7684\u5143\u7d20\u96c6\u7684z-index\uff0c\u59cb\u7ec8\u5c06\u5f53\u524d\u62d6\u52a8\u7684\u9879\u76ee\u7f6e\u4e8e\u6700\u524d\u9762\u3002\u5b83\u5728\u8bf8\u5982\u7a97\u53e3\u7ba1\u7406\u5668\u4e4b\u7c7b\u7684\u7a0b\u5e8f\u4e2d\u975e\u5e38\u6709\u7528\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n
zindex <\/td>\nz-index\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5176\u503c\u4e3a\" false\"\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

jQuery UI Draggable()\u65b9\u6cd5\u793a\u4f8b1 <\/h2>\n
\n \u6211\u4eec\u4ee5\u4e00\u4e2a\u793a\u4f8b\u6765\u6f14\u793a\u53ef\u62d6\u52a8\u529f\u80fd\uff0c\u8be5\u529f\u80fd\u4e0d\u4f1a\u5c06\u4efb\u4f55\u53c2\u6570\u4f20\u9012\u7ed9draggable()\u65b9\u6cd5\u3002\n<\/div>\n
\n
 <!DOCTYPE html>
<head><\/span>
  <link href=\"http:\/\/code.jquery.com\/ui\/1.10.4\/themes\/ui-lightness\/jquery-ui.css\" rel=\"stylesheet\">
  <script src=\"http:\/\/code.jquery.com\/jquery-1.10.2.js\"><\/script><\/span>
  <script src=\"http:\/\/code.jquery.com\/ui\/1.10.4\/jquery-ui.js\"><\/script><\/span>
  <style><\/span>
  #draggable { width: 100px; height: 100px; padding: 0.5em; background:#7fffd4;}
  <\/style><\/span>
  <script><\/span>
  $(function() {
    $( \"#draggable\").draggable();
  });
  <\/script><\/span>
<\/head><\/span>
<body><\/span>
     <div id=\"draggable\" class=\"ui-widget-content\">
<p><\/span>I am draggable!<\/p><\/span>
     <\/div><\/span>
<\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/div>\n

jQuery UI Draggable()\u65b9\u6cd5\u793a\u4f8b2 <\/h2>\n
\n \u5982\u4f55\u4f7f\u7528disabled\uff0cdistance\u548cdelay: <\/strong>\n<\/div>\n
\n \u8be5\u793a\u4f8b\u6f14\u793a\u4e86jQuery UI\u7684\u62d6\u52a8\u529f\u80fd\u4e2d\u7981\u7528\u7684\u4e09\u4e2a\u91cd\u8981\u9009\u9879\uff0c\u5ef6\u8fdf\u548c\u8ddd\u79bb\u7684\u7528\u6cd5\u3002\n<\/div>\n
\n
 <!DOCTYPE html>
   <head><\/span>
      <link href=\"http:\/\/code.jquery.com\/ui\/1.10.4\/themes\/ui-lightness\/jquery-ui.css\" rel=\"stylesheet\">
      <script src=\"http:\/\/code.jquery.com\/jquery-1.10.2.js\"><\/script><\/span>
      <script src=\"http:\/\/code.jquery.com\/ui\/1.10.4\/jquery-ui.js\"><\/script><\/span>
   <\/head><\/span>
   <body><\/span>
      <div id=\"div1\" style=\"border:solid 1px;background-color:pink;\">
         <span>I am not movable.<\/span><\/span><br \/><br \/>
      <\/div><\/span>
      <div id=\"div2\" style=\"border:solid 1px;background-color:lightgreen;\">
         <span>
            Dragging will start only after you drag me for 50px
         <\/span><\/span>
         <br \/><br \/>
      <\/div><\/span>
      <div id=\"div3\" style=\"border:solid 1px;background-color:lightyellow;\">
         <span>
            Wait for 200ms before starting to drag.
         <\/span><\/span>
         <br \/><br \/>
      <\/div><\/span>
 <script><\/span>
         $(\"#div1 span\").draggable (
            { disabled: true }
         );
         $(\"#div2 span\").draggable (
            { distance: 50 }
         );
         $(\"#div3 span\").draggable (
            { delay: 200 }
         );
 <\/script><\/span>
   <\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/div>\n

jQuery UI Draggable()\u65b9\u6cd5\u793a\u4f8b3 <\/h2>\n
\n \u901a\u8fc7\u590d\u5236\u6765\u79fb\u52a8\u5185\u5bb9: <\/strong>\n<\/div>\n
\n \u8ba9\u6211\u4eec\u4ee5\u4e00\u4e2a\u793a\u4f8b\u6765\u6f14\u793a\u5982\u4f55\u79fb\u52a8\u4f5c\u4e3a\u6240\u9009\u5143\u7d20\u514b\u9686\u7684\u5143\u7d20\u3002\u8fd9\u662f\u901a\u8fc7\u4f7f\u7528\u5e26\u6709\u503c\u514b\u9686\u7684\u9009\u9879\u5e2e\u52a9\u7a0b\u5e8f\u6765\u5b8c\u6210\u7684\u3002\n<\/div>\n
\n
  <!DOCTYPE html>
<head><\/span>
   <link href=\"http:\/\/code.jquery.com\/ui\/1.10.4\/themes\/ui-lightness\/jquery-ui.css\" rel=\"stylesheet\">
   <script src=\"http:\/\/code.jquery.com\/jquery-1.10.2.js\"><\/script><\/span>
   <script src=\"http:\/\/code.jquery.com\/ui\/1.10.4\/jquery-ui.js\"><\/script><\/span>
<\/head><\/span>
<body><\/span>
   <div id=\"div6\" style=\"border:solid 1px;background:lightyellow; height:30px;\">
      <span>You can duplicate me....<\/span><\/span>
   <\/div><\/span>
   <script><\/span>
      $(\"#div6 span\").draggable ({
         helper : \"clone\"
      });
   <\/script><\/span>
<\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/div>\n

jQuery UI Draggable()\u65b9\u6cd5\u793a\u4f8b4 <\/h2>\n
\n \u83b7\u53d6\u5f53\u524d\u9009\u9879\u503c: <\/strong>\n<\/div>\n
\n \u8ba9\u6211\u4eec\u4e3e\u4e00\u4e2a\u4f8b\u5b50\u6765\u5c55\u793a\u5982\u4f55\u60a8\u53ef\u4ee5\u5728\u811a\u672c\u6267\u884c\u671f\u95f4\u968f\u65f6\u83b7\u53d6\u4efb\u4f55\u9009\u9879\u7684\u503c\u3002\u5728\u6267\u884c\u65f6\u8bbe\u7f6ecursor\u548ccursorAt\u9009\u9879\u7684\u503c\u3002\n<\/div>\n
\n
 <!DOCTYPE html>
<head><\/span>
   <link href=\"http:\/\/code.jquery.com\/ui\/1.10.4\/themes\/ui-lightness\/jquery-ui.css\" rel=\"stylesheet\">
   <script src=\"http:\/\/code.jquery.com\/jquery-1.10.2.js\"><\/script><\/span>
   <script src=\"http:\/\/code.jquery.com\/ui\/1.10.4\/jquery-ui.js\"><\/script><\/span>
<\/head><\/span>
<body><\/span>
   <div id=\"divX\" style=\"border:solid 1px;background:lightpink; height:30px;\">
      <span>Click on me to see cursor type.<\/span><\/span>
   <\/div><\/span>
   <script><\/span>
      \/* First make the item draggable *\/
      $(\"#divX span\").draggable();
      $(\"#divX span\").bind('click', function( event ){
          var cursor = $( \"#divX span\").draggable( \"option\", \"cursor\");
          var cursorAt = $( \"#divX span\").draggable( \"option\", \"cursorAt\");
          alert(\"Cursor type - \" + cursor + \", cursorAt - \" + cursorAt);
     });
   <\/script><\/span>
<\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/div>\n

$(selector, context).draggable (\"action\", params)\u65b9\u6cd5<\/h2>\n
\n draggable(\"action\", params)\u65b9\u6cd5\u7528\u4e8e\u6267\u884c\u7c7b\u4f3c\u9632\u6b62\u4f4d\u79fb\u7684\u52a8\u4f5c\u3002\u5728\u6b64\uff0c\u5c06\u52a8\u4f5c\u6307\u5b9a\u4e3a\u5b57\u7b26\u4e32\uff0c\u5e76\u4e14\u53ef\u4ee5\u6839\u636e\u7ed9\u5b9a\u7684\u52a8\u4f5c\u63d0\u4f9b\u4e00\u4e2a\u6216\u591a\u4e2a\u53c2\u6570\u3002\n<\/div>\n
\n \u8bed\u6cd5: <\/strong>\n<\/div>\n
\n
 $(selector, context).draggable (\"action\", [params]);
<\/span><\/code><\/pre>\n<\/div>\n
\n \u4ee5\u4e0b\u662f\u6b64\u65b9\u6cd5\u4f7f\u7528\u7684\u64cd\u4f5c\u7684\u5217\u8868:\n<\/div>\n\n\n\n\n\n\n\n\n\n\n\n
\u52a8\u4f5c<\/td>\n\u8bf4\u660e<\/td>\n<\/tr>\n
destroy()<\/td>\n\u5b83\u7528\u4e8e\u5b8c\u5168\u5220\u9664\u62d6\u52a8\u529f\u80fd\u3002\u8fd9\u4e9b\u5143\u7d20\u4e0d\u518d\u53ef\u79fb\u52a8\u3002\u8fd9\u5c06\u4f7f\u5143\u7d20\u8fd4\u56de\u5176\u521d\u59cb\u72b6\u6001\u3002<\/td>\n<\/tr>\n
disable()<\/td>\n\u5b83\u7528\u4e8e\u7981\u7528\u62d6\u52a8\u529f\u80fd\u3002\u5728\u4e0b\u4e00\u6b21\u8c03\u7528draggable(\"enable\")\u65b9\u6cd5\u4e4b\u524d\uff0c\u65e0\u6cd5\u79fb\u52a8\u5143\u7d20\u3002<\/td>\n<\/tr>\n
enable()<\/td>\n\u5b83\u7528\u4e8e\u91cd\u65b0\u6fc0\u6d3b\u62d6\u52a8\u7ba1\u7406\u3002\u5143\u7d20\u53ef\u4ee5\u518d\u6b21\u79fb\u52a8\u3002<\/td>\n<\/tr>\n
option(optionname)<\/td>\n\u5b83\u83b7\u53d6\u5f53\u524d\u4e0e\u6307\u5b9a\u9009\u9879\u540d\u5173\u8054\u7684\u503c\u3002\u8fd9\u91cc\u7684optionname\u662f\u8981\u83b7\u53d6\u7684\u9009\u9879\u7684\u540d\u79f0\uff0c\u5176\u7c7b\u578b\u4e3a\u5b57\u7b26\u4e32\u3002<\/td>\n<\/tr>\n
option()<\/td>\n\u5b83\u5c06\u83b7\u53d6\u4e00\u4e2a\u5305\u542b\u952e\/\u503c\u5bf9\u7684\u5bf9\u8c61\uff0c\u8fd9\u4e9b\u952e\/\u503c\u5bf9\u8868\u793a\u5f53\u524d\u53ef\u62d6\u52a8\u9009\u9879\u7684\u54c8\u5e0c\u503c\u3002<\/td>\n<\/tr>\n
option(optionname, value)<\/td>\n\u5b83\u8bbe\u7f6e\u4e0e\u6307\u5b9a\u9009\u9879\u540d\u5173\u8054\u7684\u53ef\u62d6\u52a8\u9009\u9879\u7684\u503c\u3002\u8fd9\u91cc\u7684optionname\u662f\u8981\u8bbe\u7f6e\u7684\u9009\u9879\u7684\u540d\u79f0\uff0cvalue\u662f\u8981\u4e3a\u8be5\u9009\u9879\u8bbe\u7f6e\u7684\u503c\u3002<\/td>\n<\/tr>\n
option(options)<\/td>\n\u5b83\u4e3a\u53ef\u62d6\u52a8\u5bf9\u8c61\u8bbe\u7f6e\u4e00\u4e2a\u6216\u591a\u4e2a\u9009\u9879\u3002\u8fd9\u91cc\u7684options\u662f\u8981\u8bbe\u7f6e\u7684option-value\u5bf9\u7684\u6620\u5c04\u3002<\/td>\n<\/tr>\n
widget()<\/td>\n\u5b83\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u53ef\u62d6\u52a8\u5143\u7d20\u7684jQuery\u5bf9\u8c61\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

jQuery UI Draggable()\u65b9\u6cd5\u793a\u4f8b5 <\/h2>\n
\n \u8ba9\u6211\u4eec\u4ee5\u793a\u4f8b\u7684\u5f62\u5f0f\u67e5\u770b\u4e0a\u8868\u4e2d\u64cd\u4f5c\u7684\u4f7f\u7528\u3002\u4ee5\u4e0b\u793a\u4f8b\u6f14\u793a\u4e86\"\u7981\u7528\"\u548c\"\u542f\u7528\"\u52a8\u4f5c\u7684\u7528\u6cd5\u3002\n<\/div>\n
\n
 <!DOCTYPE html>
   <head><\/span>
      <link href=\"http:\/\/code.jquery.com\/ui\/1.10.4\/themes\/ui-lightness\/jquery-ui.css\" rel=\"stylesheet\">
      <script src=\"http:\/\/code.jquery.com\/jquery-1.10.2.js\"><\/script><\/span>
      <script src=\"http:\/\/code.jquery.com\/ui\/1.10.4\/jquery-ui.js\"><\/script><\/span>
   <\/head><\/span>
   <body><\/span>
      <div id=\"div7\" style=\"border:solid 1px;background-color:pink;\">
         <span>Dragging is disabled. You can't move me!<\/span><\/span><br><br>
      <\/div><\/span>
      <div id=\"div8\" style=\"border:solid 1px;background-color:yellow;\">
         <span>Dragging is enabled. Move Me!<\/span><\/span><br><br>
      <\/div><\/span>
      <script><\/span>
         $(\"#div7 span\").draggable ();
         $(\"#div7 span\").draggable ('disable');
         $(\"#div8 span\").draggable ();
         $(\"#div8 span\").draggable ('enable');
      <\/script><\/span>
   <\/body><\/span>
<\/html><\/span>
<\/span><\/code><\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"jQuery UI Draggablezh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[],"class_list":["post-3023","post","type-post","status-publish","format-standard","hentry","category-jquery-ui-jc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/3023"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=3023"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/3023\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=3023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=3023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=3023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}