var currentLang; var translated = $(".it").attr('href'); { $(".ita").attr('href' , translated); $(".ita-m").attr('href' , translated); } var translated = $(".en").attr('href'); { $(".eng").attr('href' , translated); $(".eng-m").attr('href' , translated); } $(".eng").click(function() { $(".eng").css('color' , "#f0bb89"); $(".ita").css('color' , "#58585b"); }); $(".ita").click(function() { $(".ita").css('color' , "#f0bb89"); $(".eng").css('color' , "#58585b"); }); $(".eng-m").click(function() { $(".eng-m").css('color' , "#f0bb89"); $(".ita-m").css('color' , "#fff"); }); $(".ita-m").click(function() { $(".ita-m").css('color' , "#f0bb89"); $(".eng-m").css('color' , "#fff"); }); if(window.location.href.indexOf("/eng/")>0 || window.location.href.indexOf("/education/")>0 || window.location.href.indexOf("/departments/")>0 || window.location.href.indexOf("/laboratories/")>0 || window.location.href.indexOf("/centers/")>0 || window.location.href.indexOf("/connected-structures/")>0 || window.location.href.indexOf("/complex-operational-units/")>0){ localStorage.setItem("lang", "en"); $(".eng").css('color' , "#f0bb89"); $(".eng-m").css('color' , "#f0bb89"); } else if(window.location.href.indexOf("/personale")<0) { localStorage.setItem("lang", "it"); $(".ita").css('color' , "#f0bb89"); $(".ita-m").css('color' , "#f0bb89"); } else { currentLang=localStorage.getItem("lang"); } $(document).ready(function(){ if(currentLang=="en") { $(".eng").css('color' , "#f0bb89"); $(".eng-m").css('color' , "#f0bb89"); $(".ita").css('color' , "#58585b"); $(".ita-m").css('color' , "#fff"); } else if(currentLang=="it") { $(".ita").css('color' , "#f0bb89"); $(".ita-m").css('color' , "#f0bb89"); $(".eng").css('color' , "#58585b"); $(".eng-m").css('color' , "#fff"); } if(currentLang=="en" && window.location.href.indexOf("/personale")>0) { $("#navbar-ita").hide(); $(".caricaita").hide(); $(".cv-ita").hide(); $(".dipartimentoita").hide(); $("#navbar-eng").show(); $(".caricaeng").show(); $(".dipartimentoeng").show(); $(".cv-eng").show(); $(".eng").click(function() { $("#navbar-ita").hide(); $(".caricaita").hide(); $(".dipartimentoita").hide(); $(".cv-ita").hide(); $("#navbar-eng").show(); $(".caricaeng").show(); $(".dipartimentoeng").show(); $(".cv-eng").show(); }); $(".ita").click(function() { $("#navbar-ita").show(); $(".caricaita").show(); $(".caricaita").show(); $(".dipartimentoita").show(); $(".cv-ita").show(); $("#navbar-eng").hide(); $(".caricaeng").hide(); $(".dipartimentoeng").hide(); $(".cv-eng").hide(); }); } else if(currentLang=="it" && window.location.href.indexOf("/personale")>0) { $("#navbar-ita").show(); $(".caricaita").show(); $(".caricaita").show(); $(".dipartimentoita").show(); $(".cv-ita").show(); $("#navbar-eng").hide(); $(".caricaeng").hide(); $(".dipartimentoeng").hide(); $(".cv-eng").hide(); $(".eng").click(function() { $("#navbar-ita").hide(); $(".caricaita").hide(); $(".dipartimentoita").hide(); $(".cv-ita").hide(); $("#navbar-eng").show(); $(".caricaeng").show(); $(".dipartimentoeng").show(); $(".cv-eng").show(); }); $(".ita").click(function() { $("#navbar-ita").show(); $(".caricaita").show(); $(".caricaita").show(); $(".dipartimentoita").show(); $(".cv-ita").show(); $("#navbar-eng").hide(); $(".caricaeng").hide(); $(".dipartimentoeng").hide(); $(".cv-eng").hide(); }); } }) /* function languageMenuMobile(x) { if (x.matches) { // If media query matches $(".eng").css('color' , "#f0bb89"); $(".ita").css('color' , "#58585b"); document.body.style.backgroundColor = "yellow"; } else { document.body.style.backgroundColor = "pink"; } } var x = window.matchMedia("(max-width: 700px)") myFunction(x) // Call listener function at run time x.addListener(myFunction) // Attach listener function on state changes */