$(document).ready(function() { var str = location.href; //check URL for sub-menu pages var patt1 = new RegExp("dashboard2.jsp"); var patt2 = new RegExp("report.jsp"); var patt3 = new RegExp("home.jsp"); var patt4 = new RegExp("dashboard.jsp"); var patt5 = new RegExp("indicator.jsp"); /*var patt5 = new RegExp("edit.jsp"); var patt6 = new RegExp("status.jsp");*/ var patt7 = new RegExp("create_user.jsp"); var patt8 = new RegExp("changepassword.jsp"); var patt9 = new RegExp("report_qtn.jsp"); //set expression for sub-menu pages var exp1 = patt1.test(str); var exp2 = patt2.test(str); var exp3 = patt3.test(str); var exp4 = patt4.test(str); var exp5 = patt5.test(str); /*var exp5 = patt5.test(str); var exp6 = patt6.test(str);*/ var exp7 = patt7.test(str); var exp8 = patt8.test(str); var exp9 = patt9.test(str); //alert(res); $('.navigation li a').each(function() { //alert(exp1); /*if (str.indexOf(this.href.toLowerCase()) > -1) { $("li.highlight").removeClass("highlight"); $(this).parent().addClass("highlight"); } else*/ if(exp1){ $("li.highlight").removeClass("highlight"); $("#menu1").parent().addClass("highlight"); } else if(exp2){ $("li.highlight").removeClass("highlight"); $("#menu2").parent().addClass("highlight"); //alert("oj"); } else if(exp3){ $("li.highlight").removeClass("highlight"); $("#hm").parent().addClass("highlight"); //alert("oj"); } else if(exp4){ $("li.highlight").removeClass("highlight"); $("#menu7").parent().addClass("highlight"); } else if(exp5){ $("li.highlight").removeClass("highlight"); $("#menu9").parent().addClass("highlight"); } else if(exp7){ $("li.highlight").removeClass("highlight"); $("#admin").parent().addClass("highlight"); } else if(exp8){ $("li.highlight").removeClass("highlight"); $("#chng_pss").parent().addClass("highlight"); } else if(exp9){ $("li.highlight").removeClass("highlight"); $("#rept_qtn").parent().addClass("highlight"); } /*else if(exp4){ $("li.highlight").removeClass("highlight"); $("#mapUpR").parent().addClass("highlight"); } else if(exp5){ $("li.highlight").removeClass("highlight"); $("#mapUp5").parent().addClass("highlight"); } else if(exp6){ alert(123) $("li.highlight").removeClass("highlight"); $("#map_CP").parent().addClass("highlight"); } else if(exp7){ $("li.highlight").removeClass("highlight"); $("#mapUp7").parent().addClass("highlight"); } else if(exp8){ $("li.highlight").removeClass("highlight"); $("#mapUp8").parent().addClass("highlight"); } else if(exp9){ $("li.highlight").removeClass("highlight"); $("#mapUp9").parent().addClass("highlight"); } else if(exp9){ $("li.highlight").removeClass("highlight"); $("#mapUp9").parent().addClass("highlight"); } else if(exp10){ $("li.highlight").removeClass("highlight"); $("#mapUp10").parent().addClass("highlight"); } else if(exp11){ //alert("dfdf") $("li.highlight").removeClass("highlight"); $("#mapUpD").parent().addClass("highlight"); } else if(exp12){ $("li.highlight").removeClass("highlight"); $("#mapUpD").parent().addClass("highlight"); } else if(exp14){ $("li.highlight").removeClass("highlight"); $("#mapUpD").parent().addClass("highlight"); } else if(exp15){ $("li.highlight").removeClass("highlight"); $("#mapUpD").parent().addClass("highlight"); }*/ }); }); //window.onscroll = function(){myFunction()}; //window.addEventListener("wheel", myFunction); var header = document.getElementById("fixHeader"); var sticky = header.offsetTop; function myFunction() { if (window.pageYOffset > sticky) { //$("#bg").slideUp("slow"); header.classList.add("sticky"); $("#bg").slideUp("slow"); } else { //$("#bg").slideDown("slow"); header.classList.remove("sticky"); $("#bg").slideDown("slow"); } }