没有 JQuery UI 的拖放 [英] Drag and drop without JQuery UI

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

问题描述

我搜索了很多内容以找到有关拖动 & 的教程.drop 单独使用 jQuery(没有 UI),但是由于 JQuery UI 的流行,所有的拖放功能都基于 JQuery UI.

I searched a lot to find a tutorial for drag & drop with jQuery alone (without UI), but due to the popularity of JQuery UI, all drag and drop features are based on JQuery UI.

谁能给我一个提示如何制作一个基本的 Drag &单独使用 JQuery 吗?

Can anyone give me a hint how to make a basic Drag & Drop by JQuery standalone?

推荐答案

我认为一个好的起点可能是规划流程,然后决定每个用户操作需要使用哪些 jQuery 工具.

I think a good starting place might be to map out the process, and then decide which jQuery tools you will need to use for each user action.

所以用户进程可能是:

  • 在可拖动"区域点击您的内容 div
  • 拖动内容,将内容保留在该 div 中
  • 松开鼠标,将内容放入可放置"容器中,该容器将调整之前内容的大小以适应可放置大小

需要以下类型的事件监听器:

which needs the following types of event listeners:

  • 鼠标移动
  • 鼠标按下
  • 动画

至少.另一种选择可能是查看 jQuery UI 源代码,看看他们是如何做到的!这将告诉您确切的操作,但您可以在必要时添加或修剪.

At the very least. Another option might be to check out the jQuery UI source, and see how they do it! Which will tell you exactly what to do but you can add to it or trim where necessary.

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

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