Skip to content

Commit

Permalink
1、修改文档
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyJingFish committed Oct 29, 2024
1 parent 7b28bbd commit 9fc6713
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/js/language-switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,27 @@ document.addEventListener("DOMContentLoaded", function () {
}
});
});

const languageSelectors4 = document.querySelectorAll(".md-nav__link");

languageSelectors4.forEach(selector => {
// console.log("DOM 完全加载和解析完成,selector1="+selector.tagName);
selector.addEventListener("click", function () {
var target = event.target || event.srcElement; // 兼容处理
if (target.nodeName.toLocaleLowerCase() === "a") { // 判断是否匹配目标元素
const href = target.getAttribute("href");
if(href == '..' || href == '.'){
localStorage.setItem('isZh', "false");
}else{
localStorage.setItem('isZh', "true");
}

event.preventDefault();
window.location.href = href

}


});
});
});

0 comments on commit 9fc6713

Please sign in to comment.