Skip to content

Instantly share code, notes, and snippets.

@SpencerCooley
Created February 16, 2012 02:55
Show Gist options
  • Select an option

  • Save SpencerCooley/1841248 to your computer and use it in GitHub Desktop.

Select an option

Save SpencerCooley/1841248 to your computer and use it in GitHub Desktop.
<script>
$($('#language.selected li').bind("click", function(){
if ($(this).parent().hasClass('selected')){
$(this).parent().removeClass('selected').addClass('selection')
} else {
$(this).parent().removeClass('selection').addClass('selected');
$(this).siblings('li').removeClass('selected');
$(this).addClass('selected');
var lang = $(this).attr('id');
$.cookie('language', null);
$.cookie('language', null, {path: '/'});
$.cookie('language', lang, {path: '/'});
$('.spanish').hide();
$('.english').hide();
$('.' + lang).show();
}
}));
$(function(){if ($.cookie('language') == 'spanish') {
$('#english').removeClass('selected');
$('#spanish').addClass('selected');
$('.spanish').show();
$('.english').hide();
} else {
$('#english').addClass('selected');
$('#spanish').removeClass('selected');
$('.spanish').hide();
$('.english').show();
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment