adjust styles
This commit is contained in:
parent
dd217e7a6a
commit
3804d13cb6
34 changed files with 756 additions and 174 deletions
|
|
@ -3,11 +3,14 @@ const verticalUnit = 1.3 * remFactor;
|
|||
|
||||
function toggleTab(data, tab) {
|
||||
if (data.activeTab === tab) {
|
||||
scrollToElem("body");
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth",
|
||||
});
|
||||
setTimeout(() => {
|
||||
data.activeTab = "";
|
||||
data.isOpen = false;
|
||||
}, 200);
|
||||
data.activeTab = "";
|
||||
}, 300);
|
||||
} else {
|
||||
data.activeTab = tab;
|
||||
data.isOpen = true;
|
||||
|
|
@ -28,6 +31,24 @@ function scrollToElem(selector) {
|
|||
}, 100);
|
||||
}
|
||||
|
||||
function setWindowHeightFactor() {
|
||||
const windowHeight = window.innerHeight;
|
||||
const min = 650;
|
||||
const delta = windowHeight - min;
|
||||
const factor = roundToNearestHalf(delta / 150);
|
||||
|
||||
const head = document.querySelector("head");
|
||||
const style = document.createElement("style");
|
||||
style.innerText = `:root { --window-height-factor:${factor} }`;
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
function roundToNearestHalf(num) {
|
||||
return Math.round(num * 2) / 2;
|
||||
}
|
||||
|
||||
setWindowHeightFactor();
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
function toggleLogoState() {
|
||||
const scrollY = window.scrollY || window.pageYOffset;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue