Magic beer bucket: For loops for squirrel tabs style [JavaScript]

Squirrels in a magic pocket
Thirsty squirrels in another magic pocket. Alex

When you’re thirsty in the summertime, it makes no sense to drink warm beer. Those bottles must travel to a cool bucket of ice to undergo a familiar transformation in preparation for our pleasure: glass skin collects dew and cools, the contents soon following.

The cold beer awaits. Time to drink. You diligently unhinge each and every cap as you and your friends work through your six pack. Exhausting. Wouldn’t it make more sense to build a bucket that popped the cap off your beer as you reached for it? Heck, what about a bucket that grew like a magical multidimensional pocket, able to cool and open any number of beers?

I present the magical beer bucket, in Javascript. This chunk of code will cycle through all the items on your navigation array and apply styling to each of them as you click on each one. Handy! Truly, a magical pocket able to contain any number of squirrels.

See the Pen Using ‘for’ loops to control tab appearances by tumolillo (@hellotumo) on CodePen.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.