mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-17 07:52:16 +00:00
* redesign & code BIP39 * optimize the UI after hide private infomation * toggle button styles in table * responsive web design & add filter effect when hide private data * translate into chinese * transtate update * modify meta tag * decrease container's width * favicon & site title * page header * language test * layout fine-turning * Add ignores * Update compile script * Correct replace styling behavior * Add deploy shell script * Move assets to root, change according image src * update content: form__recovery_phrase__hint * Remove `.DS_Store` * Add Google GA script * Update favicon tag and 'loading' zh translation * remove tippyjs * remove tippyjs files * remove npm package Co-authored-by: Franco Chen <chenhuifan.gg@gmail.com>
61 lines
1.7 KiB
JavaScript
61 lines
1.7 KiB
JavaScript
// Solution: https://css-tricks.com/sticky-smooth-active-nav/
|
|
function smoothScroll() {
|
|
let mainNavLinks = document.querySelectorAll(".js-anchor-link");
|
|
|
|
window.addEventListener("scroll", (event) => {
|
|
let fromTop = window.scrollY;
|
|
|
|
mainNavLinks.forEach((link) => {
|
|
let section = document.querySelector(link.hash);
|
|
|
|
if (
|
|
section.offsetTop <= fromTop &&
|
|
section.offsetTop + section.offsetHeight > fromTop
|
|
) {
|
|
link.classList.add("anchor-link-active");
|
|
} else {
|
|
link.classList.remove("anchor-link-active");
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
// Get the trigger of dropdown
|
|
const enableDropdown = (btnID, menuID) => {
|
|
const dropdownActiveClass = "dropdown__menu--active";
|
|
|
|
const trigger = document.getElementById(btnID);
|
|
|
|
// Get content of dropdown
|
|
const dropdownMenu = document.getElementById(menuID);
|
|
|
|
const showDropdown = () => {
|
|
dropdownMenu.classList.add(dropdownActiveClass);
|
|
};
|
|
|
|
const hideDropdown = () => {
|
|
dropdownMenu.classList.remove(dropdownActiveClass);
|
|
};
|
|
|
|
// Click trigger to show content of dropdown
|
|
trigger.addEventListener("click", function () {
|
|
if (
|
|
dropdownMenu.classList.contains(dropdownActiveClass)
|
|
) {
|
|
hideDropdown();
|
|
} else {
|
|
showDropdown();
|
|
}
|
|
});
|
|
|
|
// Hide content of dropdown if click outside of dropdown element
|
|
document.addEventListener("click", (event) => {
|
|
if (event.target.closest(".js-dropdown")) return
|
|
hideDropdown();
|
|
});
|
|
}
|
|
|
|
smoothScroll();
|
|
enableDropdown("recoveryPhrasePopoverBtn", "recoveryPhrasePopoverContent");
|
|
enableDropdown("languagePopoverBtn", "languagePopoverContent");
|
|
enableDropdown("derivedAddressesPopoverBtn", "derivedAddressesPopoverContent"); |