(function($){ // // DIV must be style="display:none;" // $.fn.chk_userlanguage = function() { /* check if <style=display:none;> not set to that element */ if (!this.is(":hidden")) { this.hide(); }; /* get browser default lang */ if (navigator.userLanguage) { baseLang = navigator.userLanguage.substring(0,2).toLowerCase(); } else { baseLang = navigator.language.substring(0,2).toLowerCase(); } /* language match */ switch(baseLang) { case "de": /* german */ this.slideDown("slow"); break; case "en": /* english */ break; case "ja": /* japanese */ break; case "zh": /* 中文 */ break; default: /* default no match */ } }; })(jQuery);
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/8807.html