Reorganize JavaScript code
This commit is contained in:
parent
31ddcfce63
commit
751b4c1c01
1 changed files with 14 additions and 19 deletions
|
@ -18,17 +18,19 @@ const navImage = document.querySelector('.home__nav-image');
|
||||||
const circleTypes = [];
|
const circleTypes = [];
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// LOGIC
|
// UTILS
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// HELPERS
|
|
||||||
|
|
||||||
// Convert rem to pixels by getting font-size CSS property
|
// Convert rem to pixels by getting font-size CSS property
|
||||||
function convertRemToPixels(rem) {
|
function convertRemToPixels(rem) {
|
||||||
let fontSize = parseFloat(window.getComputedStyle(document.body).getPropertyValue('font-size'));
|
let fontSize = parseFloat(window.getComputedStyle(document.body).getPropertyValue('font-size'));
|
||||||
return rem * fontSize;
|
return rem * fontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// LOGIC
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// HOME NAVIGATION DISPLAY //
|
// HOME NAVIGATION DISPLAY //
|
||||||
|
|
||||||
// Calculate navigation grid inner width
|
// Calculate navigation grid inner width
|
||||||
|
@ -181,26 +183,19 @@ function waveNavLinksOnHover() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleNavDisplay() {
|
|
||||||
window.addEventListener('load', function() {
|
|
||||||
curveNavLinks();
|
|
||||||
setNavItemTranslationProperty();
|
|
||||||
setNavGridDisplay();
|
|
||||||
editNavLinksOnResize();
|
|
||||||
waveNavLinksOnHover();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// PROGRAM
|
// PROGRAM
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
// Enable CSS :active pseudo-class in Safari Mobile
|
||||||
|
document.addEventListener("touchstart", function() {},false);
|
||||||
|
|
||||||
document.addEventListener("touchstart", function() {},false); // Enable CSS :active pseudo-class in Safari Mobile
|
// HOME NAVIGATION DISPLAY //
|
||||||
|
|
||||||
// HOME NAVIGATION DISPLAY //
|
|
||||||
|
|
||||||
handleNavDisplay();
|
|
||||||
|
|
||||||
|
window.addEventListener('load', function() {
|
||||||
|
curveNavLinks();
|
||||||
|
setNavItemTranslationProperty();
|
||||||
|
setNavGridDisplay();
|
||||||
|
editNavLinksOnResize();
|
||||||
|
waveNavLinksOnHover();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue