jQuery API 返回首页目录 | jQuery API 中英文对照版
Droppable(options)

Droppable(options)

With the Draggables plugin, Droppable allows you to create drop zones for draggable elements.

参数

  • 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 } )
相关链接
asp之家 | jQuery官方网站 | jQuery中文网 | 电子书作者网站 | 电子书作者blog