jQuery UI拖动(拖)处理和取消

  

定义和用法

<>之前只有当光标在,draggable 上指定部分时才允许拖拽。使用,handle 选项来指定用于拖拽对象的元素(或元素组)的,jQuery 选择   器或者当光标在,draggable 内指定元素(或元素组)上时不允许拖拽。使用,取消选项来指定取消拖拽功能的,jQuery 选择器


示例

 & lt; ! DOCTYPE  html>
  & lt; html>
  & lt; head>
  & lt; meta  charset=" utf - 8 "比;
  & lt; meta  http-equiv=" X-UA-Compatible ",内容=癐E=边缘”比;
  & lt; title> jQuery  UI 拖动(拖),安康;处理和Cancel
  & lt; link  rel="样式表",href=" https://www.yisu.com/zixun/js/jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/jquery-ui.min.css "比;
  & lt; style>
  # draggable2  {# draggable1,还以为;
  宽度:200 px,,
  身高:200 px,,
  填充:时间0.5 em;大敌;;
  浮动:,,,
  保证金:0,10 px  10 px  0;,
  }
  
  ,,{# draggable  p 
  ,,光标:,,,
  ,,}
  & lt;/style>
  & lt;/head>
  & lt; body>
  & lt; div  id=" draggable1 ",类=皍i-widget-content”比;
  ,,& lt; p 类=" ui-widget-header "在您只可以在这个范围内拖拽我& lt;/p>
  & lt;/div>
  ,
  & lt; div  id=" draggable2 ",类=皍i-widget-content”比;
  ,,& lt; p>您可以把我向四周拖拽& lt;/p>
  ,,& lt; p 类=" ui-widget-header "祝辞但是您不可以在这个范围内拖拽我& lt;/p>
  & lt;/div>
  
  & lt; script  src=" https://www.yisu.com/zixun/js/jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/external/jquery/jquery.js ", type=" text/javascript,祝辞& lt;/script>
  & lt; script  src=" https://www.yisu.com/zixun/js/jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/jquery-ui.min.js "祝辞& lt;/script>
  & lt; script>
  $(函数(){
  $ (" # draggable1 ") .draggable ({
  处理:“p”
  });
  
  $ (" # draggable2 ") .draggable ({
  取消:“p.ui-widget-header”
  });
  });
  & lt;/script>
  & lt;/body>
  & lt;/html> 


输出

 jQuery UI拖动(拖)处理和取消”> </p><h2 class=jQuery UI拖动(拖)处理和取消