How can I change my Javasscript logic based on breakpoints and element sizes?

The X and Y values just need to be multiplied by a scale factor when determining the absolute position.

For example the third block in the second row would have X=3 and Y=2. If the blocks are 92x92 then the scale factor is 92 and you get 276 and 184 for the absolute position. If the blocks are reduced in size to 50x50 then the scale factor is 50 and that position becomes 150 and 100.

No need to store anything on the blocks themselves as everything can be stored in the array and the scale factor applied when transferring the info in the array to actual positioning of the blocks…