说三道四技术文摘-感悟人生的经典句子
说三道四 > 文档快照

Droppable(options)-JQuery API

HTML文档下载 WORD文档下载 PDF文档下载
Droppable(options)拖放插件,允许您创建可拖动元素拖放区。

Droppable(options)

拖放插件,允许您创建可拖动元素拖放区。

 

参数

options (Hash): A hash of options 

Hash 选项

  • accept (String): The class name for draggables to get accepted by the droppable (mandatory)
  • activeclass (String): When an acceptable draggable is moved, the droppable gets this class
  • hoverclass (String): When an acceptable draggable is inside the droppable, the droppable gets this class
  • tolerance (String): Choose from 'pointer', 'intersect', or 'fit'. The pointer options means that the pointer must be inside the droppable in order for the draggable to be dropped. The intersect option means that the draggable must intersect the droppable. The fit option means that the entire draggable must be inside the droppable.
  • onDrop (Function): When an acceptable draggable is dropped on a droppable, this callback is called. It passes the draggable DOMElement as a parameter.
  • onHover (Function): When an acceptable draggable is hovered over a droppable, this callback is called. It passes the draggable DOMElement as a parameter.
  • onOut (Function): When an acceptable draggable leaves a droppable, this callback is called. It passes the draggable DOMElement as a parameter.  

示例

jQuery 代码:

$('#dropzone1').Droppable( { accept : 'dropaccept', activeclass: 'dropzoneactive', hoverclass: 'dropzonehover', ondrop: function (drag) { alert(this); //the droppable alert(drag); //the draggable }, fit: true } )

备案号:鲁ICP备13029499号-2 说三道四 www.s3d4.cn 说三道四技术文摘