search
HomeWeb Front-endJS TutorialSummary of implementation methods of JQuery UI's drag and drop function_jquery

The API provided by JQuery UI greatly simplifies the development of drag and drop functions. Just call the draggable and droppable functions on the drag source and target respectively.

Principle of Drag and Drop
First of all, we need to clarify a few concepts.
Source: drag source, element to be dragged.
Taerget: Drag and drop target, a container that can be placed into the source.
The drag action is broken down as follows:
1. drag start: press the mouse on the drag source (source) and start moving
2. drag move: during the movement
3. drag enter : move into the target container
4. drag leave: move out of the target container
5. drop: release the mouse on the target container
6. drag end: end
Before HTML5, page elements did not directly support drag events. Therefore, the drag-and-drop function is implemented by listening to mouse events and recording the drag-and-drop status.

The simplest example
The simplest drag does not change the container where the element is located, but only changes its position. An example is as follows:

Copy code The code is as follows:






Drag me!





Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment