new nav buttons
This commit is contained in:
parent
7e21e1ffb7
commit
92625d2fb9
11 changed files with 552 additions and 39 deletions
|
|
@ -73,25 +73,24 @@ function roundToNearestHalf(num) {
|
|||
return Math.max(round, 0);
|
||||
}
|
||||
|
||||
function enableToggleTabsVisibility() {
|
||||
const tabs = document.querySelector("#tabs");
|
||||
const toggleLeftBtn = tabs.querySelector("button.toggle.left");
|
||||
const toggleRightBtn = tabs.querySelector("button.toggle.right");
|
||||
const toggleLeftBtnWidth = toggleLeftBtn.offsetWidth;
|
||||
const toggleRightBtnWidth = toggleRightBtn.offsetWidth;
|
||||
function enableToggleEntriesVisibility() {
|
||||
const entries = document.querySelector("#entries");
|
||||
|
||||
toggleLeftBtn.style = `--width: ${toggleLeftBtnWidth}px`;
|
||||
toggleRightBtn.style = `--width: ${toggleRightBtnWidth}px`;
|
||||
const leftBtn = entries.querySelector(".entry-btn--left");
|
||||
const rightBtn = entries.querySelector(".entry-btn--right");
|
||||
const leftBtnWidth = leftBtn.offsetWidth;
|
||||
const rightBtnWidth = rightBtn.offsetWidth;
|
||||
|
||||
const toggleVisibility = (entries) => {
|
||||
entries.forEach((entry) => {
|
||||
const isIntersecting = entry.isIntersecting;
|
||||
leftBtn.style = `--width: ${leftBtnWidth}px`;
|
||||
rightBtn.style = `--width: ${rightBtnWidth}px`;
|
||||
|
||||
const toggleVisibility = (items) => {
|
||||
items.forEach((item) => {
|
||||
const isIntersecting = item.isIntersecting;
|
||||
if (isIntersecting) {
|
||||
console.log("is intersecting");
|
||||
tabs.classList.remove("minimized");
|
||||
entries.classList.remove("minimized");
|
||||
} else {
|
||||
console.log("is not intersecting");
|
||||
tabs.classList.add("minimized");
|
||||
entries.classList.add("minimized");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -104,7 +103,7 @@ function enableToggleTabsVisibility() {
|
|||
threshold: 0,
|
||||
});
|
||||
|
||||
observer.observe(tabs);
|
||||
observer.observe(entries);
|
||||
}
|
||||
|
||||
function toggleLogoState() {
|
||||
|
|
@ -132,6 +131,6 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
|
||||
// Wait for fonts applied
|
||||
setTimeout(() => {
|
||||
enableToggleTabsVisibility();
|
||||
enableToggleEntriesVisibility();
|
||||
}, 100);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue