Good all the time of the day gentlemen.

Imagine a desktop on which icons are aligned not on a grid, and not automatically, but in inconsistency, crooked, as girls usually like to do (I’m not talking about everyone). If there is a kitten on the desktop, then the icons are sure to flow around this kitten)

Now imagine a web page, it has a table, inside it there are several div 's ( ~200х250px , they have id p1010 , z200 ). Below is Table 2, its size is always different. I want to 'take' div 's (how many are unknown) and alternately drag them onto table 2. And if there already is a div ' s, then there is an opportunity to change their position, if necessary. The result is a 'randomly' located on the div 's page. And here, I want to save their location (I immediately recall ajax, but from ajax I know only the simple ). Remembering the position is eating, but in order to have this table 2, then edit the current divs on it

Can anyone give an example of a code, how can it even be done about it?

ps In many cases, the solutions that are on the hashcode in a simple form are being finalized and no worse than what can be prepared by Google to find, which must first be cut back if you are lucky, and then add. So I want some kind of construction, simple, so that you can penetrate and adjust in your own way.

    1 answer 1

    I did something similar on my project. Used jquery ui sortable (connect list) . At the end of the transfer, a timer was started, which after a certain period of time sent an ajax request, or the trace was turned off when transferring. object. For the preservation of positions was responsible sqlite, which recorded the values ​​of objects. When you open a page from the database, these objects were selected for their positions.

    Example: http://jsfiddle.net/5QgYP/

    • He himself dug in this direction, tried to understand the examples, so far unfortunately to no avail - sergey
    • What is stalled? Are your items being dragged? If not, then do it, there are many instructions on the Internet. How to get a collection of tags, how to send and process them - I will. - lampa
    • Stopped here on what. Everywhere I find the so-called lists on which the names are written, and they can be dragged up and down relative to each other. That's actually. - Sergey
    • one
      jsfiddle.net/5QgYP look. The console.log displays the generated array of elements. - lampa
    • one
      That's probably what you need [jQuery-Droppable] [1], and [here] [2] there is a description in Russian [2]: jquery.page2page.ru/index.php5/… [1]: jqueryui.com/droppable / # propagation - Artyomich