I would like to keep the tricky way that @rexboy7 did because the styles of all the tiles can be all decided by CSS, without any JS involved. That should be a way that I am going to do more, leave all the style stuff to CSS and JS handles the app logic.