jQuery code to implement free dragging and sorting of elements

不言
Release: 2018-07-17 17:49:29
Original
1510 people have browsed it

Although sorting can be achieved by moving elements up and down, it is not flexible enough and rigid, and cannot quickly achieve the purpose of sorting we want. Below we explain how to quickly drag and drop to the sorting position you want.

First of all, we need to introduce a plug-in gridly.js to implement element dragging.

    

Copy after login

The following simple lines of js code can achieve the functions we want:

( dom='' ( i = 0; i <= 10; i++(i%2!=0+='

'+i+'

'+='

'+i+'

''.gridly')[0]).append(dom); reordering = reordered = arrdom= array=[]; $.each(arrdom,'.gridly' $('.gridly'100, gutter: 20, columns: 7
Copy after login

The effect is as shown below:

Explanation below: This plug-in is very simple and easy to use. When we find that setting the number of columns to display and the line spacing has no effect, we might as well open the gridly.js source code, find the following method, and set it up.

Related recommendations:

jQuery drag sorting plug-in to create drag sorting effect (with source code download)_jquery

Jquery drag and drop sorting simple implementation method (enhanced version)_jquery

The above is the detailed content of jQuery code to implement free dragging and sorting of elements. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!