by tzmudzin · 10y ago · 0 comments
Following this principle code example 2 (i.e. Javascript after deduplication) would be the sweet spot. It fulfills the requirements without in the most obvious way, at a good level of abstraction (the requirements did not make any of the three pictures specific -- defining a separate function for each actually goes beyond the requirements, while obscuring the higher-level goal).
All of the subsequent examples focus on using the features of the platform rather than clearly showing the purpose of the code, i.e. unnecessarily obfuscate it.
OTOH I agree that using jQuery for animation doesn't add anything, particularly now that CSS Animation is omnipresent. My initial though on the problem was "Can I do this in pure CSS?", not to go to javascript. And since it turns out you can't, the logical next question is why the desired behavior is actually desired, instead of e.g. just making the image a thumbnail and a clickable link to the full-size image. So really the entire question is an example of overengineering, requiring an absurd amount of technology for a feature you aren't even sure you want.