mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-20 06:21:09 +02:00
Fix: Click anywhere on the language switch menu to switch the language (#2144)
close: https://github.com/google/comprehensive-rust/issues/2132
This commit is contained in:
parent
e70de3eb27
commit
d2f8fc4ac5
@ -224,6 +224,18 @@
|
||||
lang.href = `${full_path_to_root}${lang.id}/${path}`;
|
||||
}
|
||||
}
|
||||
|
||||
// When the user clicks a list item, the page jump is performed, just like clicking the internal <a> tag.
|
||||
langList.querySelectorAll("li").forEach(function(li) {
|
||||
li.addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
let link = this.querySelector("a");
|
||||
if (link && window.location.href !== link.href) {
|
||||
window.location.href = link.href;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{{#if print_enable}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user