I'm facing a unique challenge on my website related to the z-index
. The content's z-index
is lower but somehow appears above the menus (z-index: 4;
) on mobile or resized browsers. To understand this issue better, let's delve into the CSS behind it:
- To enable CSS animation, I had to include a parent
div
element for the images as CSS generatedcontent
was necessary. - The
div
for animation conflicts with the Image Viewer functionality, causing JavaScript to detect the click/tap on theevent.target
of thediv
instead of the image itself. - Adding
position: relative; z-index: 1;
solved the Image Viewer problem, allowing interaction with the images, but created an issue in another area. - On mobile devices, these images incorrectly seem closer to the user than the menus, despite the menu having a higher
z-index: 4;
and usingposition: fixed;
.
Here are some attempts I've made to address this problem:
- I have experimented with different
position
values while maintaining the current layout, but haven't found a solution yet. - Using
z-index: 4 !important;
did not affect the menu as expected. - Setting
z-index: 0;
or lower values for the images caused the click/tap event to target the parentdiv
instead of the image, which is essential for the animation. - I've verified that no other elements or CSS-generated components have conflicting property/value pairs like
position
andz-index
.
This issue is present in Waterfox, Chrome, and Safari. It's puzzling because relative
should take precedence over fixed
, and the higher z-index
values are being disregarded by all three browsers simultaneously. I am actively working on resolving this, but a second opinion would be greatly appreciated at this point.
Please note that this is a temporary URL and should not be indexed by search engines:
Any insights or suggestions?