jQuery UI-从可排序拖放到可拖放 [英] JQuery UI - Drag from Sortable to Droppable

查看:86
本文介绍了jQuery UI-从可排序拖放到可拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可排序的图像列表.要删除它们,用户会将它们从可排序"列表中拖动到代表垃圾桶的Droppable div中.我该怎么做?

I have a list of images which are sortable. To delete them, the user will drag them from the Sortable list to a Droppable div representing a trashcan. How can I accomplish this?

我需要为每个图像添加一个可拖动对象以使其与可放置对象一起工作吗?

Do I need to add a draggable to each of the image for it to work with the droppable?

推荐答案

接受的答案似乎提供了错误的信息.对于以后引用此帖子的任何人,

The accepted answer seems to provide faulty information. For anyone referring to this post in future,

来自 rjmunro

可伸缩表已经可以拖动.无需将它们明确声明为可拖动.

Sortables are already draggable. There's no need to explicitly declare them as draggable.

JSFiddle演示

来自 JQuery UI文档-

默认情况下,可排序项目共享可拖动属性.

By default, sortable items share draggable properties.

这篇关于jQuery UI-从可排序拖放到可拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆