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 = [];
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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,26 +183,19 @@ function waveNavLinksOnHover() {
|
|||
}
|
||||
}
|
||||
|
||||
function handleNavDisplay() {
|
||||
window.addEventListener('load', function() {
|
||||
// ----------------------------------------------------------------------------
|
||||
// PROGRAM
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Enable CSS :active pseudo-class in Safari Mobile
|
||||
document.addEventListener("touchstart", function() {},false);
|
||||
|
||||
// HOME NAVIGATION DISPLAY //
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
curveNavLinks();
|
||||
setNavItemTranslationProperty();
|
||||
setNavGridDisplay();
|
||||
editNavLinksOnResize();
|
||||
waveNavLinksOnHover();
|
||||
});
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PROGRAM
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
document.addEventListener("touchstart", function() {},false); // Enable CSS :active pseudo-class in Safari Mobile
|
||||
|
||||
// HOME NAVIGATION DISPLAY //
|
||||
|
||||
handleNavDisplay();
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue