2
It would be able to capture all the DOM objects and sort them by a set of rules. For example, in the code below the attributes data-Gs-x="0" data-Gs-y="0" define the position (x, y) on screen. I would like to take the elements considering the order of the coordinates.
The return should follow the order:
- Object (0,0)
- Object (4,0)
- Object (8,0)
- Object (0,4)
- Subject matter (4,4)
- Subject matter (8,4)
- Object (0,8)
- Subject matter (4,8)
<div data-gs-x="0" data-gs-y="0" data-gs-width="4" data-gs-height="4" class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide"> </div>
<div data-gs-x="4" data-gs-y="0" data-gs-width="4" data-gs-height="4" class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide"> </div>
<div data-gs-x="8" data-gs-y="0" data-gs-width="4" data-gs-height="4" class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide"> </div>
<div data-gs-x="0" data-gs-y="4" data-gs-width="4" data-gs-height="4" class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide"> </div>
<div data-gs-x="4" data-gs-y="4" data-gs-width="4" data-gs-height="4" class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide"> </div>
<div data-gs-x="8" data-gs-y="4" data-gs-width="4" data-gs-height="4" class="grid-stack-item ui-draggable ui-resizable ui-resizable-autohide"> </div>