Created
June 1, 2013 16:06
-
-
Save afrael/5690869 to your computer and use it in GitHub Desktop.
Localizable content using Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="#" class="scroller" data-section="#about"><span lang="EN">About</span><span lang="ES">Acerca De</span></a> | |
<script> | |
$('.set_lang_EN').click(function(){ | |
$("[lang]").each(function () { | |
if ($(this).attr("lang") == "EN") | |
$(this).show(); | |
else | |
$(this).hide(); | |
}); | |
}); | |
$('.set_lang_ES').click(function(){ | |
$("[lang]").each(function () { | |
if ($(this).attr("lang") == "ES") | |
$(this).show(); | |
else | |
$(this).hide(); | |
}); | |
}); | |
// set default | |
$("[lang]").each(function () { | |
if ($(this).attr("lang") == "ES") | |
$(this).show(); | |
else | |
$(this).hide(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment