Reorganize JavaScript code

This commit is contained in:
Paul Nicoué 2022-04-28 14:55:36 +02:00
parent 31ddcfce63
commit 751b4c1c01

View file

@ -18,17 +18,19 @@ const navImage = document.querySelector('.home__nav-image');
const circleTypes = [];
// ----------------------------------------------------------------------------
// LOGIC
// UTILS
// ----------------------------------------------------------------------------
// HELPERS
// Convert rem to pixels by getting font-size CSS property
function convertRemToPixels(rem) {
let fontSize = parseFloat(window.getComputedStyle(document.body).getPropertyValue('font-size'));
return rem * fontSize;
}
// ----------------------------------------------------------------------------
// LOGIC
// ----------------------------------------------------------------------------
// HOME NAVIGATION DISPLAY //
// Calculate navigation grid inner width
@ -181,7 +183,15 @@ function waveNavLinksOnHover() {
}
}
function handleNavDisplay() {
// ----------------------------------------------------------------------------
// PROGRAM
// ----------------------------------------------------------------------------
// Enable CSS :active pseudo-class in Safari Mobile
document.addEventListener("touchstart", function() {},false);
// HOME NAVIGATION DISPLAY //
window.addEventListener('load', function() {
curveNavLinks();
setNavItemTranslationProperty();
@ -189,18 +199,3 @@ function handleNavDisplay() {
editNavLinksOnResize();
waveNavLinksOnHover();
});
}
// ----------------------------------------------------------------------------
// PROGRAM
// ----------------------------------------------------------------------------
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener("touchstart", function() {},false); // Enable CSS :active pseudo-class in Safari Mobile
// HOME NAVIGATION DISPLAY //
handleNavDisplay();
});