Home >Web Front-end >JS Tutorial >Simple jquery drag and drop sorting effect implementation code_jquery

Simple jquery drag and drop sorting effect implementation code_jquery

WBOY
WBOYOriginal
2016-05-16 18:02:011335browse

Steps:
1. Realize the effect of moving with the mouse;
2. Initialize an element and its coordinates;
3. Drag the last coordinates of the object, and calculate and judge with the coordinates of the element to determine what to insert The target element;
4. Use insertBefore method to insert in front of the target element
The specific code is as follows:

Copy code The code is as follows:





Tested drag function




< body>

div1

div2

div3

div4

div5



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn