Closed GiovaneBueno closed 11 years ago
No answer?
Hey sorry I've been a little busy with work lately. If I understand you correctly you want to get the index position of each item after it has been arranged. To do so you will need to listen for the arrange event which is outlined in the documentation here
Basically you will have to listen for that arrange event on the parent container by doing this:
$containers.on("ss-arranged", function(e) {
...
});
Now every time the children get arranged within the container the code inside that function will run. You can get the index positions of the children by doing this:
$containers.on("ss-arranged", function(e) {
$(this).children().each(function() {
$(this).index(); // Returns the index position.
});
});
Hope that helps, let me know if you have any additional questions.
What you showed on example, works. But I used "ss-drop-complete". Yet it is with index, there is no way to capture the "id" of each element?
Ex:
<div id="content">
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
</div>
Returning: "div1","div2","div3".
I ask sorry, for the inconvenience..
Tank's.
Ohh sorry you meant the literal ID. It would still work the same, except now you would do:
$containers.on("ss-arranged", function(e) {
$(this).children().each(function() {
$(this).index(); // Returns the index position
$(this).attr("id"); // Returns the ID of the child
});
});
Thank you for your attention, solved my doubt!
I'm in doubt about, catch all elements by "id" in the order they are and move on to an array. And do it at an event after an item has been changed of position.