HTML Structure
The first defined language is used as the default language.
EspañolItalianEnglishDeutscheFrench
CSS Styles
.language { display: -webkit-flex !important; display: -ms-flexbox !important; display: flex !important; -webkit-align-items: center !important; -ms-flex-align: center !important; align-items: center !important; } .language img { margin-right: 10px; } #lanNavSel { position: relative; top: -8px; left: 8px; }
JavaScript Initialization
new JLang();
JLang Options
Option Name | Description |
---|---|
id | Dropdown id name. (Default: 'languages') |
framework | Framework name. (Default: 'materialize') |
cookieExp | Cookie expiration time in days. (Default: 30) |
cookieLangName | Cookie name for save the selected language name. (Default: 'lname') |
cookieLangCode | Cookie name for save the selected language code. (Default: 'lcode') |
abbreviation | Display abbreviation and caret. (Default: true) |
reload | Reload page when selecting language. (Default: true) |
alignment | Dropdown aligned to the left or right of button. (Default: 'left') |
hover | Activate on hover. (Default: true) |
JLang Demo
new JLang({ id: 'languages', framework: 'materialize', cookieExp: 30, cookieLangName: 'lname', cookieLangCode: 'lcode', abbreviation: true, reload: true, alignment: 'left', hover: true } );
js-language-dropdown