jQuery drag and drop plug-in gridster usage guide_jquery
gridster.js is a jQuery plug-in used to build intuitive drag-and-drop layouts that support multi-column layouts. You can also dynamically add and delete elements in the table.
1.gridster plug-in function
Implement a function similar to win8 tile drag and drop
2.gridster official address
There are also plug-in help and examples on the official website, but according to the official instructions, I always have problems like this when I test it locally. One is that it cannot be moved, and the other is that there is a black spot near the magnet, which may It is used for positioning. But if used normally on the website, such black spots should not appear. The properties and methods of the gridster plug-in are described in detail on the official website.
After testing it, the problem was finally solved. The effect is shown as follows:
3. How to use gridster
1. First quote the js file
<script type="text/javascript" src=" jquery-1.7.2.min.js"></script> <script type="text/javascript" src=" jquery.gridster.js"></script> <link rel="stylesheet" type="text/css" href=" style.css" />
2.css used
<style type="text/css"> .handle { border-bottom: 1px solid black; } .small img{ height:83px; width:97px; } .gridster { position:relative; background-color:#CCC; } li { background-color: white; width: 150px; height: 300px; border: solid 2px black; } .gridster > * { margin: 0 auto; -webkit-transition: height .4s; -moz-transition: height .4s; -o-transition: height .4s; -ms-transition: height .4s; transition: height .4s; } .gridster .gs_w{ z-index: 2; position: absolute; } .ready .gs_w:not(.preview-holder) { -webkit-transition: opacity .3s, left .3s, top .3s; -moz-transition: opacity .3s, left .3s, top .3s; -o-transition: opacity .3s, left .3s, top .3s; transition: opacity .3s, left .3s, top .3s; } .ready .gs_w:not(.preview-holder) { -webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; -moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; -o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; } .gridster .preview-holder { z-index: 1; position: absolute; background-color: #fff; border-color: #fff; opacity: 0.3; } .gridster .player-revert { z-index: 10!important; -webkit-transition: left .3s, top .3s!important; -moz-transition: left .3s, top .3s!important; -o-transition: left .3s, top .3s!important; transition: left .3s, top .3s!important; } .gridster .dragging { z-index: 10!important; -webkit-transition: all 0s !important; -moz-transition: all 0s !important; -o-transition: all 0s !important; transition: all 0s !important; } p{ margin:10px; }
3. js code used
$(function(){ $(".gridster ul").gridster({ widget_margins: [5, 5], widget_base_dimensions: [100, 100], draggable: { handle: '.handle' } }); var gridster = $(".gridster ul").gridster().data('gridster'); });
4. HTML used
<div class="gridster"> <ul id="reszable"> <li data-row="1" data-col="1" data-sizex="1" data-sizey="1"><div class="handle">1</div><div class="small"><img src="test.jpg" /></div></li> <li data-row="2" data-col="1" data-sizex="1" data-sizey="1"><div class="handle">2</div></li> <li data-row="3" data-col="1" data-sizex="1" data-sizey="1"><div class="handle">3</div></li> <li data-row="1" data-col="2" data-sizex="2" data-sizey="1"><div class="handle">4</div></li> <li data-row="2" data-col="2" data-sizex="2" data-sizey="2"><div class="handle">5</div><p> Like no other javascript library, Parsley has a full support for #UX concerns and detailed options. Override almost every Parsley default behaviors to fit your exact needs.</p></li> <li data-row="1" data-col="4" data-sizex="1" data-sizey="1"><div class="handle">6</div></li> <li data-row="2" data-col="4" data-sizex="2" data-sizey="1"><div class="handle">7</div></li> <li data-row="3" data-col="4" data-sizex="1" data-sizey="1"><div class="handle">8</div></li> <li data-row="1" data-col="5" data-sizex="1" data-sizey="1"><div class="handle">9</div></li> <li data-row="3" data-col="5" data-sizex="1" data-sizey="1"><div class="handle">10</div></li> <li data-row="1" data-col="6" data-sizex="1" data-sizey="1"><div class="handle">11</div></li> <li data-row="2" data-col="6" data-sizex="1" data-sizey="2"><div class="handle">12</div></li> <li data-row="1" data-col="7" data-sizex="1" data-sizey="1"><div class="handle">13</div></li> <li data-row="2" data-col="7" data-sizex="1" data-sizey="1"><div class="handle">14</div></li> <li data-row="3" data-col="7" data-sizex="1" data-sizey="1"><div class="handle">15</div></li> </ul> </div>
4.gridster usage instructions
The gridster plug-in works normally in Chrome and Firefox, and the special effects display page works normally. However, it displays normally in IE8, but the drag effects cannot be displayed.
Now you can open it to see the drag effect, Oh, it’s so embarrassing! You will also find that it is not smooth. This may be a small bug or imperfection in Girdster. How to improve it, I will talk about it tomorrow!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.

How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...

Discussion on the realization of parallax scrolling and element animation effects in this article will explore how to achieve similar to Shiseido official website (https://www.shiseido.co.jp/sb/wonderland/)...

JavaScript can be run in PowerPoint, and can be implemented by calling external JavaScript files or embedding HTML files through VBA. 1. To use VBA to call JavaScript files, you need to enable macros and have VBA programming knowledge. 2. Embed HTML files containing JavaScript, which are simple and easy to use but are subject to security restrictions. Advantages include extended functions and flexibility, while disadvantages involve security, compatibility and complexity. In practice, attention should be paid to security, compatibility, performance and user experience.

Learning JavaScript is not difficult, but it is challenging. 1) Understand basic concepts such as variables, data types, functions, etc. 2) Master asynchronous programming and implement it through event loops. 3) Use DOM operations and Promise to handle asynchronous requests. 4) Avoid common mistakes and use debugging techniques. 5) Optimize performance and follow best practices.
