mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-24 11:20:58 +00:00
redesign & code BIP39 (#1)
* 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>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
// 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");
|
||||
Reference in New Issue
Block a user