4 ms·
I agree this may be subjective, but aren't we crossing the line when the 'how' becomes more important than the 'what' (i.e. the purpose of the code?) Following
by tzmudzin 10y ago
I agree this may be subjective, but aren't we crossing the line when the 'how' becomes more important than the 'what' (i.e. the purpose of the code?)
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.
- deleted 10y ago[deleted]
- Mathnerd314 10y agoThere is a good argument for using $('.image').on('click', clickImage); instead of attaching three click handlers clickImage[ABC] and hardcoding those in HTML, which probably explains why jQuery is so popular. 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.