When load your page come with a <body class="it">
, and all the :lang(en)
tags will be hidden.
body.en :lang(it) {
display: none;
}
body.it :lang(en) {
display: none;
}
And when you need to change the language, simply change the className
of <body>
.
$("#en").click(function(){
document.body.className = 'en';
};
Which is more elegant, and way faster.
demo: http://jsfiddle.net/Gw4eQ/
Use :not
selector to make it work with more languages. demo
body:not(.en) :lang(en),
body:not(.it) :lang(it),
body:not(.fr) :lang(fr) {
display: none;
}