Resolved problem with z-index and fixed positioning in the mobile version of Safari

Is there an issue with the site here:

The primary content scrolls up over the countdown and under the navigation, both of which are fixed elements. This functions correctly on desktop, but on mobile Safari, the content scrolls behind the countdown when the user moves up, only to pop in front once touch is released.

I'm curious if this is a bug or something that can be resolved?

Below is the CSS code:

#header { position: fixed; width: 100%; top: 0px; z-index: 10; }
#content { width: 100%; position: relative; top: 650px; z-index: 7; }
#banner { position: fixed; width: 100%; position: fixed; background: url('http://kaye.at/baby/img/stork.jpg') no-repeat center bottom #fff; padding-top: 185px; z-index: 1; }
#defaultCountdown { max-width: 70%; height: auto; }

And here's the HTML structure:

<div id="header">
    <div id="nav">
        <ul>
            <li><a class="active" href="index.php">START</a></li>
            <li><a href="ultrasound-images.php">ULTRASOUND PICS</a></li>
            <li><a href="pinkorblue.php">PINK OR BLUE?</a></li>
        </ul>
    </div>
</div>

<div id="banner">
   <div id="defaultCountdown"></div>
</div>

<div id="content">
</div>

Answer №1

Wow, simply incredible. I made a simple addition:

-webkit-transform: translate3d(0,0,0);

This was added to the #content division.

Answer №2

Avoid using position:fixed in Mobile Safari for better performance

Ensure you apply the following CSS to your scrolling container and all its child elements:

.scrolling-container {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.scrolling-container .child-element {
    position: relative;
    -webkit-transform: translate3d(0,0,0);
}

Answer №3

To resolve the issue, simply add the following CSS properties: #banner {z-index:-1} and body {background:transparent}. Your problem will then be fixed.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Are your box-sizing and media queries failing to function properly?

I am struggling to create a responsive page that has specific layout specifications based on screen width. My goal is to: Hide the right chat info box when the page is under 1000px wide Additionally, I want to: Hide both the right chat box and left side ...

Dynamic banner image

I currently have a jumbotron image in the background, but it isn't as responsive and I'm struggling to get the whole image to display properly. Here is what it looks like currently: https://i.sstatic.net/IpuDi.png Here is the full image for ref ...

Angular 10 encountering issues with loading Bootstrap styles

I'm currently working on a project that involves Angular 10 and the Bootstrap library. However, I'm encountering an issue where the Bootstrap styles are not loading properly. Upon checking the package.json file, I can see that Bootstrap is liste ...

In Javascript, the color can be changed by clicking on an object, and the color

Looking for help with my current HTML code: <li><a href="index.php" id="1" onclick="document.getElementById('1').style.background = '#8B4513';">Weblog</a></li> The color changes while clicking, but when the lin ...

Assigning a new classification to the primary object in the evolving array of objects

I'm working with an element that loops through all the objects using v-for and has a CSS class named top-class{}... I need to dynamically add the top-class to the first object (object[0]) and update it based on changes, removing the old top-class in t ...

Troubleshooting Problem with Bootstrap 4 Navigation Drop-Down Menu

I am working on developing some navigation forms for my university projects. I encountered an issue where I selected the Book item, and the navigation was working fine. However, when I selected Child items and then clicked on the Organization item, the nav ...

How can we activate navigation on a mobile browser?

I am currently working on a small HTML5/JavaScript website designed to be accessed by mobile browsers on devices such as Android and iPhone. I am utilizing the geolocation feature of HTML5 to obtain the user's current location, but my goal is to then ...

It is not possible to delete a class from an element once it has been added

Issue can be replicated by visiting the following URL: Click on the hamburger icon to open the navigation menu Click on "Services" Click "< Services" within the submenu to attempt to go back For some reason, the removeClass method is not removing t ...

Using column-count within a media query is not supported

I am encountering an issue with my CSS code that includes the column-count property within a media query, and for some unknown reason, it doesn't seem to be working! .masonry { -webkit-column-count: 3; -moz-column-count: 3; column-count: ...

Having Multiple Login Forms on a Single Page

I have encountered an issue with my login form code. It works perfectly as a single form, but I need to have 20 of these forms on one page. Despite my efforts to duplicate the code for each new form and adjusting the IDs, I am unable to make more than one ...

Ways to determine the text field value without the need for a submit button

I need help with a calculation that doesn't require a submit button. I want to automatically calculate and display the total value in a text field based on the weight, height, and number of pieces entered by the user without having to refresh the page ...

Is it possible for images underneath to receive focus when hovering over them?

I'm struggling with a layout of thumbnails on my page. We'll refer to them as A, B, C, etc. They are currently displayed like this: A, B, C, D, E, F, G, H, I, J, K, L, M, N... and so on. When you hover over one thumbnail, it enlarges by 2.5 t ...

What is the best way to implement two-way data binding to show local storage data on an input field in HTML?

After successfully fetching all the necessary data from a sign-up API, I am looking to display this data as default in specific fields on a page (such as First Name, Last Name, Email, and Phone Number). Any help with achieving this would be greatly appre ...

Having trouble clicking the button due to the overlay blocking it?

This code contains the HTML portion <li id="nav1" class="navs"><a unselectable="on" draggable="false" class="Navigation" href="http://youtube.com">YouTube</a></li> Below is the CSS code .navs:after { content: ""; position: ab ...

Preventing touch scrolling within a container with an overflow set to scroll/auto feature and enabling dragging within the container

Help needed: Issue with scrolling inner div within draggable outer div. I am facing an issue where I am unable to scroll the inner box properly on my iPad. The problem arises when I try to scroll the inner box, and the outer box starts moving instead. I ...

SASS mixin that enables flexbox capabilities without supporting older, legacy versions of flexbox

Is it possible to provide support for browsers lacking flexbox compatibility (such as IE) while using SASS mixins? I have been quickly implementing the display:flex property with the following mixin. However, I am facing challenges with IE and need to man ...

Trouble with Boostrap popover functionality when injecting HTML into the code

I am facing a challenge in creating dynamic popovers that are triggered by a 'dictionary' array to insert HTML content into existing text on the webpage. Initially, the code was meant for tooltips and worked flawlessly. However, I am now attempti ...

html issue with the footer

Just starting out with HTML and encountering some difficulties with adding a footer. The main issue is that when I add the footer, the 'form' element gets stretched all the way down until it reaches the footer - you can see an example of this her ...

When the flexDirection is set to row, Material-UI input labels will appear outside of

Currently, I am facing an unusual situation. In my code, I have incorporated 2 div elements within a FormControl, and everything appears to be working correctly with the input label for the Select. However, when I apply styling with flexDirection: 'ro ...

Swapping out images by clicking on a thumbnail, featuring numerous occurrences on a single webpage

I'm currently working on a project where I need to display several large images with corresponding thumbnails. When a user clicks on a thumbnail, I want the larger version of that thumbnail to replace the current large image. While I have successfull ...