Skip to main content
Inspiring
March 25, 2025
Answered

Overlay maybe conflicting with link on MOBILE only

  • March 25, 2025
  • 1 reply
  • 173 views

This pertains mainly to mobile so please inspect on mobile phone simulator

 

I have an overlay menu https://pitchlab.net/lowdown/index_test_overlay.html

 

and a container with a few paragraphs with text and a link-

the link only appears clickable if the z-index of the container is higher than the overlay.

But then the text shows over the overlay, when the menu overlay is toggled (click on upper left menu)

 

.lowdown_flex_container {

z-index:500;

 

.mainNavLinksWrapper {
z-index: 499;

 

same issue here

 

https://pitchlab.net/index_test_overlay.html

 

the EXPLORE link works only if the z-index of "fade-in" is higher than the overlay but shows up over the overlay once toggled..

 

I think making the overlay invisible and visible on toggle would work..

 

I tried adjusting my current css and javascript:

 

.mainNavLinksWrapper {
display: grid;
place-items: center;
position: fixed;
top: 0;
width: 100%;
height: 100%;
transform: translateY(100%);
transition: all 800ms ease-in-out;
z-index: 499;
}
.mainNavLinksWrapperSlideUp {
transform: translateY(0)!important;
}

 

and

 

const menu_container = document.querySelector('.hamburger');

menu_container.onclick = function() {
const overlayWrapper = document.querySelector('.overlayWrapper');
overlayWrapper.classList.toggle('overlayWrapperSlideDown');

const mainNavLinksWrapper = document.querySelector('.mainNavLinksWrapper');
mainNavLinksWrapper.classList.toggle('mainNavLinksWrapperSlideUp');
}

 

to

 

.mainNavLinksWrapper {
display: grid;
place-items: center;
position: fixed;
top: 0;
width: 100%;
height: 100%;
transform: translateY(100%);
transition: transform 800ms ease-in-out, opacity 400ms ease-in-out;
z-index: 499;
opacity: 0;
visibility: hidden;
}

.mainNavLinksWrapperSlideUp {
transform: translateY(0) !important;
opacity: 1;
visibility: visible !important;
}

 

and

 

const menu_container = document.querySelector('.hamburger');

menu_container.onclick = function () {
const mainNavLinksWrapper = document.querySelector('.mainNavLinksWrapper');

// Toggle the slide-up class
mainNavLinksWrapper.classList.toggle('mainNavLinksWrapperSlideUp');

// Check if the menu is currently visible and hide it after the transition
if (mainNavLinksWrapper.classList.contains('mainNavLinksWrapperSlideUp')) {
mainNavLinksWrapper.style.visibility = 'visible'; // Show the menu
mainNavLinksWrapper.style.opacity = '1';
} else {
mainNavLinksWrapper.style.opacity = '0';
setTimeout(() => {
mainNavLinksWrapper.style.visibility = 'hidden'; // Hide after transition
}, 800); // Wait for transition to complete
}
};

 

 

but that didnt work.. what am i getting wrong?

 

    Correct answer REELHERO

    ok well I figured it out..

     

    I simplified the JS using the wrapper's display declaration and it worked

     

    const menu_container = document.querySelector('.hamburger');

    menu_container.onclick = function () {
    const overlayWrapper = document.querySelector('.overlayWrapper');
    overlayWrapper.classList.toggle('overlayWrapperSlideDown');

    const mainNavLinksWrapper = document.querySelector('.mainNavLinksWrapper');

    // Toggle visibility with display
    if (mainNavLinksWrapper.style.display === 'none' || mainNavLinksWrapper.style.display === '') {
    mainNavLinksWrapper.style.display = 'grid'; // Show the menu
    } else {
    mainNavLinksWrapper.style.display = 'none'; // Hide the menu
    }

    mainNavLinksWrapper.classList.toggle('mainNavLinksWrapperSlideUp');
    };

     

    1 reply

    REELHEROAuthorCorrect answer
    Inspiring
    March 27, 2025

    ok well I figured it out..

     

    I simplified the JS using the wrapper's display declaration and it worked

     

    const menu_container = document.querySelector('.hamburger');

    menu_container.onclick = function () {
    const overlayWrapper = document.querySelector('.overlayWrapper');
    overlayWrapper.classList.toggle('overlayWrapperSlideDown');

    const mainNavLinksWrapper = document.querySelector('.mainNavLinksWrapper');

    // Toggle visibility with display
    if (mainNavLinksWrapper.style.display === 'none' || mainNavLinksWrapper.style.display === '') {
    mainNavLinksWrapper.style.display = 'grid'; // Show the menu
    } else {
    mainNavLinksWrapper.style.display = 'none'; // Hide the menu
    }

    mainNavLinksWrapper.classList.toggle('mainNavLinksWrapperSlideUp');
    };