Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery UI Examples - Droppable

jQuery UI Examples - Droppable

Creates targets for draggable widgets.

For more details about the droppable interaction, see the API documentation Droppable Widget。

Default functionality

Enables droppable functionality on any DOM element and creates targets for draggable widgets.









  

  jQuery UI 放置(Droppable) - 默认功能

  

  

  

  

  

  





 

请把我拖拽到目标处!

请放置在这里!

accept

Use accept The option specifies which element (or group of elements) the target droppable accepts.









  

  jQuery UI 放置(Droppable) - 接受

  

  

  

  

  

  





 

我是不能被放置的 draggable

请拖拽我到目标

accept: '#draggable'

Prevent propagation

When using nested droppables - for example, you might have a tree-shaped editable directory structure with folder and document nodes - greedy Set the option to true to prevent event propagation when a draggable is dropped on a child node (droppable).









  

  jQuery UI 放置(Droppable) - 防止传播

  

  

  

  

  

  





 

请拖拽我到目标

外部 droppable

内部 droppable(不带有 greedy)

外部 droppable

内部 droppable(带有 greedy)

Restore the draggable's position

When a draggable with the boolean revert option set stops dragging, returns the draggable (or its helper) to its original position.









  

  jQuery UI 放置(Droppable) - 还原 draggable 的位置

  

  

  

  

  

  





 

当被放置在目标上时还原

当未被放置在目标上时还原

请放置在这里

Shopping cart demo

Demonstrates how to use an accordion to display a product catalog structure, use drag and drop to add products to the cart, and sort the products in the cart.









  

  jQuery UI 放置(Droppable) - 购物车演示

  

  

  

  

  

  





 

产品

T-Shirts

  • Lolcat Shirt
  • Cheezeburger Shirt
  • Buckit Shirt

Bags

  • Zebra Striped
  • Black Leather
  • Alligator Leather

Gadgets

  • iPhone
  • iPod
  • iPad

购物车

  1. 添加产品到这里

Simple photo manager

You can delete photos by dragging them to the trash or clicking the trash icon.

You can restore photos by dragging them to the album or clicking the recycle icon.

You can view a larger image by clicking the zoom icon. The jQuery UI dialog widget is used for the modal window.









  

  jQuery UI 放置(Droppable) - 简单的照片管理器

  

  

  

  

  

  





 

回收站 回收站

Visual feedback

Change the appearance of a droppable when hovering over it or when it is active (that is, when an acceptable draggable is dropped on the droppable). Use the hoverClass or activeClass option to specify the respective classes.









  

  jQuery UI 放置(Droppable) - 视觉反馈

  

  

  

  

  

  





 

当悬停在 droppable 上时的反馈:

请拖拽我到目标

请放置在这里

当激活 draggable 时的反馈:

请拖拽我到目标

请放置在这里