Created
September 9, 2013 07:30
-
-
Save vdchristelle/6492489 to your computer and use it in GitHub Desktop.
make a select from our language list
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
if($(window).width() > 550){ | |
// make a select from our language list | |
$('.language ul').each(function(){ | |
var select = $(document.createElement('select')).attr('class', 'select').insertBefore($(this).hide()); | |
$('ul.language-switcher-locale-url > li').each(function(){ | |
var link = $(this).find('a'); | |
var url = link.attr('href'); | |
option = $(document.createElement('option')).appendTo(select).val(url).html($(this).html()); | |
if (link.hasClass('active')) {option.attr('selected', 'selected');} | |
else {option.removeAttr('selected');} | |
}); | |
}); | |
// bind href to select | |
$('.select').live('change', function(){ | |
var Val = $(this).val(); | |
document.location.href = Val; | |
}); | |
// make our select stylable | |
$('.language select').coreUISelect(); | |
}; // end > 550 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment