$(function() { $(".header_box .header_left").click(function () { if (window.location.pathname !== "/index.html") { window.location.href = "/index.html"; } }); let nav_info = $(".header_root").data("nav_info"); $(".header_box > .header_right > .header_nav_item").removeClass("selected"); if (nav_info) { $(".header_box > .header_right > .header_nav_item.nav_" + nav_info).addClass("selected"); } $(".header_box > .header_right").on("click", ".header_nav_item", function (ev) { $(".header_box > .header_right > .header_nav_item").removeClass("selected"); let nav_num = $(this).data("nav"); $(".header_box > .header_right > .header_nav_item.nav_" + nav_num).addClass("selected"); if (nav_num === 1) { if (window.location.pathname !== "/sections/product.html") { window.location.href = "/sections/product.html"; } } else if (nav_num === 2) { if (window.location.pathname !== "/sections/service.html") { window.location.href = "/sections/service.html"; } } else if (nav_num === 3) { if (window.location.pathname !== "/sections/about.html") { window.location.href = "/sections/about.html"; } } else if (nav_num === 4) { if (window.location.pathname !== "/sections/trial.html") { window.location.href = "/sections/trial.html"; } } else if (nav_num === 5) { if (window.location.pathname !== "/sections/news.html") { window.location.href = "/sections/news.html"; } } }); let _pathname = window.location.pathname; if (_pathname === "/index.html" || _pathname === "/") { $(window).on("scroll", function() { let top = $(window).scrollTop(); if(top > 100){ $(".header_root").addClass("bg_white"); } else { $(".header_root").removeClass("bg_white"); } }); } });