Drag and drop without JQuery UI

后端 未结 7 911
春和景丽
春和景丽 2020-12-14 19:50

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 JQuer

相关标签:
7条回答
  • 2020-12-14 20:16

    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.

    so the user process might be:

    • Click on your content div on a "draggable" area
    • Drag the content, which will keep the content inside that div
    • release the mouse, which will put the content into a "droppable" container, which will adjust the size of the previous content to fit the droppable size

    which needs the following types of event listeners:

    • mouseup
    • mousedown
    • animate

    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.

    0 讨论(0)
提交回复
热议问题