問題描述
我搜索了很多內(nèi)容以找到有關(guān)拖動 & 的教程.drop 單獨(dú)使用 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 &單獨(dú)使用 JQuery 嗎?
Can anyone give me a hint how to make a basic Drag & Drop by JQuery standalone?
推薦答案
我認(rèn)為一個好的起點(diǎn)可能是規(guī)劃流程,然后決定每個用戶操作需要使用哪些 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.
所以用戶進(jìn)程可能是:
- 在可拖動"區(qū)域點(diǎn)擊您的內(nèi)容 div
- 拖動內(nèi)容,將內(nèi)容保留在該 div 中
- 松開鼠標(biāo),將內(nèi)容放入可放置"容器中,該容器將調(diào)整之前內(nèi)容的大小以適應(yīng)可放置大小
需要以下類型的事件監(jiān)聽器:
which needs the following types of event listeners:
- 鼠標(biāo)移動
- 鼠標(biāo)按下
- 動畫
至少.另一種選擇可能是查看 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.
這篇關(guān)于沒有 JQuery UI 的拖放的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!