New feature allows for smooth scrolling of fixed position footer on iPhone X

I recently developed a hybrid HTML5 app using the Trigger.io framework. The app features a fixed footer and a scrolling content area which function properly on most devices, except for the iPhone X. When scrolling on the iPhone X, I noticed that the footer actually moves out of view slightly.

Here is how the app appears with the footer in view:

https://i.sstatic.net/UMGnE.png

However, as soon as I begin scrolling down, the footer disappears and only reappears when scrolling back up.

https://i.sstatic.net/YGnbQ.png

Although I have implemented optimizations for the iPhone X notch in the design, the issue of the footer scrolling remains unresolved.

Since my app is built using a hybrid framework, the interface is constructed using HTML + CSS rather than native UI components.

Any insights into why the footer might be behaving this way specifically on the iPhone X?

Answer №1

If you're looking to prevent an element from scrolling within a scrollable container, one option is to place the said element outside of the scrollable area and use CSS to fix its position. For example:

<div id="scroll-container">
  <div id="scrollable">
  </div>
<div>

This setup will ensure that any content within the #scroll-container will scroll while elements in the "not-scrollable" portion remain fixed in their position.

By applying position:fixed;, position:absolute;, or position:sticky; in the CSS for #not-scrollable, you can prevent it from scrolling along with the rest of the content. However, keep in mind that this will make the element relative to its parent container (in this case, the body tag) rather than the scrolling container.

If your goal is to customize the layout specifically for devices like the iPhone X, there are resources available online that provide guidelines on optimizing websites for such screens. Feel free to explore these suggestions and adapt them to suit your needs!

Answer №2

In my experience with previous web projects, I have successfully used the position:sticky; property in most cases. It's a helpful feature that tends to work well. If you're curious about browser compatibility, you can check out this link: Can you use position sticky?

One trick I had to implement for FireFox and iOS Safari was wrapping the entire content in a <div>. This included fixing elements like headers and footers. I discovered that these fixed/sticky elements are relative to their parent container, so once the parent ended, the fixed/sticky behavior would break and cause bugs.

If this simple workaround doesn't solve your issue, I recommend following the advice given by @RandomChannel.

Answer №3

 <div class="container">
    <div class="scrollable-section">
    // scrollable content
    Let's insert some text hereLet's insert some text here
    Let's insert some text hereLet's insert some text here
    Let's insert some text hereLet's insert some text here
    Let's insert some text hereLet's insert some text here
    Let's insert some text hereLet's insert some text here
    Let's insert some text hereLet's insert some text here
    Let's insert some text hereLet's insert some text here
    Let's insert some text hereLet's insert some text here
    </div>
    <div class="fixed-footer">
    // fixed footer
    </div>
</div>

// CSS

.container {
 height: 100vh;
 position: fixed;
 }
.scrollable-section {
 height: 95vh;
 overflow-y:auto; 
 border: 1px solid #000;
}
.fixed-footer {
 height: 5vh; 
position: fixed; 
width: 100%; 
}

Answer №4

Suggesting a solution using JQuery

Styling with CSS

body
  margin: 0

#CustomClassOrID
  height: 10em // adjust as needed
  width: 100%
  //background-color: red
  position: absolute // or fixed

JQuery Implementation

resize = () => {
  var obj = $(document)
  docWidth = obj.width() //Not necessary
  docHeight = obj.height()
  $("#CustomClassOrID").css({
    top: docHeight - $("#CustomClassOrID").height()
  })
}

$(window).resize(() => {
  resize()
})

resize()

Answer №5

Avoid using the fixed position in CSS. Instead, experiment with the translateZ() CSS function, which can reposition an element on the z-axis in a 3D space, moving it closer or further away from the viewer. This function produces a data type known as <transform-function>.

Take a look at this HTML snippet:

<div>Static</div>
<div class="moved">Moved</div>

And here's some CSS code:

div {
  position: relative;
  width: 100px;
  height: 1000px;
  left: 200px;
  background-color: black;
}
.moved {
  transform: perspective(400px) translateZ(180px);
  background-color: red;
}

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

Unable to display a mesh using THREE js

Could there be an issue with my implementation of THREE.Mesh? I'm attempting to generate a torus mesh in three.js using what I believe to be correct mathematical calculations. However, the result is only displaying a portion of the torus, and changing ...

Rendering High-quality Images in Internet Explorer Browser

Currently, I am working on optimizing my website for high resolution monitors, particularly the new iPad. The site is already formatted to my liking, with images having increased resolutions while still fitting into specific DIVs. For instance, an image wi ...

Causing a 404 error with Htaccess RewriteRule and parameters

I have a WordPress website set up on my localhost in a folder named "abcd". The address is localhost/abcd. I want to redirect localhost/abcd/xxx/first/second to localhost/abcd/xxx?a=first&b=second. I tried using this .htaccess code, but it's not ...

Can JavaScript and CSS be used to dynamically style textarea content as it is being typed by the user?

I am wondering if it is possible to apply styling to content in a textarea as a user inputs text. For instance: <textarea>abcdefghijklmnopqrstuvwxyz</textarea> Is there a way to highlight all the vowels in the textarea string above using jav ...

Learn how to incorporate a consistent header and footer across multiple pages on a website with Node.js, ExpressJS, and either hbs or ejs templates

Creating a common header (navbar) and footer page to be included in multiple/several pages of a website. I want to create a dynamic website using Node.js and Express.js. The code for the navbar and footer will be placed in a common file named header.html ...

Ways to compel links to open in Internet Explorer

In one of my chatbot messages, I have included a link to a web app that is only compatible with Internet Explorer. My chatbot runs on Google Chrome, so when the user clicks on the link, it opens in a new Chrome tab instead of in IE, where it should open f ...

What is the best way to link my PHP variable to a JavaScript variable within a While loop?

My goal is to create a website that retrieves information from a MySQL database and displays pictures upon clicking a button. echo "<img align=\"left\"src=\"".$path[$y]."\" alt=\"error\">"; echo "<img align=\"r ...

Achieving equal height in Bootstrap columns

Artwork Hey everyone, I'm facing a small dilemma. Currently, I am tackling a project with a unique design. Within the layout of this project, there is an image section that is causing some trouble for me. I am aiming to create a portion of the webs ...

Unable to remove the layers of uncertainty to reveal the contents. No table view cell

I have a table view with a custom cell and I'm encountering an error when trying to assign a value to a variable in the custom UITableViewCell. It seems that the issue might be related to the variable not being initialized, but I'm struggling to ...

Create an array of subarrays in NSMutableArray where every pair of objects is grouped together, with a blank string included at

Question: I'm wondering if there is a more optimal approach to achieve this task or if the current method is already efficient enough? Requirements: Create a new array of objects containing unique pairs of strings from a given array, and finally add ...

Internet Explorer 9 fails to recognize angular objects when used inside ngRepeat

One issue I encountered was with the ng-include and ng-controller nested inside an ng-repeat, causing some unexpected behavior in Internet Explorer: Here is a snippet from main.html: <section ng-repeat="panel in sidepanels"> <h2 class="twelve ...

Unable to set the max-height to 100% on textarea in CSS

Within my div, I have a layout consisting of a header, textarea, and footer. The header and footer adjust their size based on content, while the textarea fills the remaining space. To ensure the textarea does not exceed 100% height, I set its max-height to ...

What is the best way to combine two rows within a single cell using HTML?

Is there a way to create two rows within a single cell? Here is the code snippet that I came up with. I utilized the rowspan attribute to extend the cell width. <tr> <th rowspan="2">Questions</th> <th>sub1</th> <th& ...

Transform URL Structure with UrlRewrite and htaccess - A Step-by-Step Guide

Currently, I am using the following URL: http://server.com/index.php?page1=main&page2=contacts I would like to change it to: http://server.com/main/contacts Can anyone provide guidance on how to write an .htaccess file with sample code for this red ...

Issue with binding background images to DIV elements in Angular 4 CSS

Here is a template example: <div [style.background-image]="profileImage" ></div> In the TypeScript file: We declare private profileImage: any; and use DomSanitizer for security. Fetching photo from service: We set this.profileImage using b ...

The expected behavior of flex shrink is not being achieved when the flex direction is set to

After setting the flex-direction to "row", images in a snippet and sandbox shrink as expected. However, changing it to "column" causes the images to not shrink as they should. Attempts to set the height based on other suggestions have been unsuccessful. T ...

What techniques can be employed to create a fully operational web application using AngularJS?

I have taken on the challenge of understanding AngularJS by creating a webapp. Within my Eclipse environment, I am working with 4 files: main.js, index.html, view1.js, and view2.html. Currently, I can get index.html to load when Tomcat is running. Embedd ...

Having a fixed bottom line bar that does not affect the length of the div when

I am working on creating an input field with a rounded bottom line. My goal is to make the main div expand or contract based on the length of the input, with specified minimum and maximum lengths. https://i.sstatic.net/REqld.png Instead of taking up the ...

Split a column into two at the md breakpoint with Bootstrap

I am looking to rearrange the cards in a specific order on breakpoint -md. Please refer to the image below for reference. https://i.sstatic.net/UXABN.png The goal is clarified in the image above. I would prefer if this can be achieved using bootstrap and ...

Firefox and Opera not affected by pointer-events on scrollbars

While working on a CSS dropdown menu, I encountered an issue with the pointer-events property in Firefox 44. Initially, I assumed it was a bug in the newer version of Firefox, but upon testing, I found the same problem in Firefox 25 and even in Opera 18, w ...