KittyGiraudel / ama

Ask me anything!
43 stars 4 forks source link

CSS Click Events #86

Closed fana11 closed 7 years ago

fana11 commented 7 years ago

Hi Hugo, I've just your article https://tympanus.net/codrops/2012/12/17/css-click-events/

As a complete newbie in coding, and having google without success, I'd appreciate if you could help me trying to understand if this could be achieved: following your article, could I change the content (text) of my website into a new content? What I'm trying to do is to give the user a new version (translated) after a click event.

I am trying at all costs having to use javascript, simply because many users block javascript on their machines....

Thanks a lot, and thank again for sharing your knowledge.

Fana

KittyGiraudel commented 7 years ago

Hello,

CSS is not meant to handle click events. This article is old, and while not necessary outdated, this is a hack that should not be used as it causes a lot of accessibility problems. JavaScript is the solution for that case of yours, and you should not be afraid to use it. Very few people actively block JavaScript, most of them actually use AdBlockers to block JavaScript-powered ads.

If you want some sort of button to toggle between pieces of content, you could have a look at a11y-toggle. Otherwise, it you want to translate the whole page, you might need to have actual distinct pages, one for each language. It would be better, also for SEO reasons.

I hope it helps!