January 4, 2016
No Javascript Please!
You probably load 100k jQuery in your page, because it makes programming soooo easy. But what if you want your page to be as small as 100k? Or usable by people who disable Javascript for security reasons?
Let us look at what the 100k jQuery in your website actually does. I bet it toggles your hamburger menu, it might toggle some tabs… and, of course, it powers that enormous homepage slider. So… without further ado, let me present you the replacements:
- Off-screen navigation - Hiding and showing stuff is no problem with CSS. Alle you need is the radio button hack, et voila… there you go.
- Tabs - They are useful for hiding and showing content. You can use the same recipe for them.
- Sliders - A little more complicated but also possible… Even with autoplay! Here are some examples.
If you really MUST support IE8 or you want a more polished experience, you can use some conditional (vanilla) Javascript. In general, you should prefer to use Javascript only when necessary and only to enhance the experience. You do not want your site to be broken without.
() Joost van der Schee