Re:Show HN: MineSweeper implemented in 100% CSS and HTML – n...
by James0x57 on Thursday July 23, 2020 @10:43AM
(#23927854)
This is awesome - Could you please explain how you're holding state of each box individually without checkbox:checked? It's not immediately obvious to me how that's possible or where it's happening in your code!
[ Parent
| on HN ]
Re:Show HN: MineSweeper implemented in 100% CSS and HTML – n...
by cnees on Thursday July 23, 2020 @12:21PM
(#23928993)
Thanks!
I use scroll position to keep the state. In effect, each square is in a div with overflow:hidden. (In the actual code I used <i>, not <div>, which might've been to save bytes because the server is so slow). It has a fixed visible height, the height of the square. Above the fold (before scrolling) is the un-clicked square, and below the fold (what you see after scrolling) is the clicked square.
Since overflow is hidden, you have to use an in-page anchor link to scroll to the clicked state. The unclicked version of each cell is an anchor to the clicked version.
Re:Show HN: MineSweeper implemented in 100% CSS and HTML – n...
by James0x57 on Thursday July 23, 2020 @01:56PM
(#23930144)
wow, that's super clever. I was sitting here reading the code and didn't find a negative margin or positional property anywhere, and further, no switches to hold the state. Couldn't for the life of me figure out what you were doing hahaha I love it
Thank you!