The feature for height is not functioning correctly on IOS devices, specifically iPhones

Recently, I designed a website on CodePen which you can view here. My goal was to make it responsive across all platforms, but I encountered an issue specifically with IOS. It seems like a single div covers the entire page on IOS and some height elements are not functioning properly, causing content to not fit correctly.

Despite spending days trying to troubleshoot, I still cannot figure out why the heights and rules are acting differently on IOS.

I attempted to remove the video section, which did reveal most of the page except for the blank white eind section. Adding max-height seemed to improve the situation slightly, but the limitation in vertical space remains unresolved on IOS, making this solution inadequate.

Changing the position property also didn't yield any positive results.

It appears that the height properties are malfunctioning exclusively on IOS. Can anyone assist me in understanding the root cause of this issue?

(JavaScript snippet here)
(CSS code snippet here)

Answer №1

The issue is not with IOS specifically, but rather with responsiveness. By setting a fixed height for each section, they are overlapping on mobile devices.

To fix this, simply set all section heights to height: 100vh.

Additionally,

@media (max-width: 430px){
    .introductie {
    height: 300vh;
    overflow: hidden;
}
}

This solution should resolve the problem.

Answer №2

I have discovered the solution I was looking for.

It turned out to be a JS script that automatically determines the window's height and assigns that height to a specific class.

However, that alone didn't solve the issue completely. The heights were more consistent and no longer scattered when I applied height:100%; to the html, body, and section elements.

I implemented media queries based on the max-height for different phone sizes to ensure proper expansion beyond the designated sections.

Visit the website here

The JavaScript solution is as follows:

// Code snippet for setting div height to window height on document ready
$(document).ready(function(){ 

    var nVer = navigator.appVersion;
    var nAgt = navigator.userAgent;
    var nameOffset,verOffset,ix;

    if(navigator.platform == 'iPhone' || navigator.platform == 'iPod'){
        if ((verOffset=nAgt.indexOf('Safari'))!=-1) {
          var mobileSafari = 'Safari';
        }
    }

    //===== FULL HEIGHT =====\\

    if (mobileSafari == 'Safari') { 
        $('.full-height').css('height',(($(window).height()) + 60)+'px');
    } else {
        $('.full-height').css({'height':($(window).height())+'px'});  
    };
});

// Additional resizing logic for maintaining correct height on window resize
$(window).resize(function(){
    if (mobileSafari == 'Safari') { 
        $('.full-height').css('height',(($(window).height()) + 60)+'px');
    } else {
        $('.full-height').css({'height':($(window).height())+'px'});  
    };

 /* //===== HALF HEIGHT =====\\

    if (mobileSafari == 'Safari') { 
        $('.half-height').css('min-height', (($(window).height() / 2) + 60) + 'px'/2);
    } else {
        $('.half-height').css({'min-height': ($(window).height()/2) +'px'});
    };

$(window).resize(function(){
    if (mobileSafari == 'Safari') { 
        $('.half-height').css('min-height', (($(window).height()/ 2) + 60) + 'px');
    } else {
        $('.half-height').css({'min-height': ($(window).height()/ 2) + 'px'});
    };
});

    // Other sizing logics follow here...

});

And here is the CSS (using SCSS) solution:

// Media queries for various phone sizes
@media (max-height: 736px) {
  .full-height{
    max-height:736px;
  }
  .introductie-mobile {
    height: 1200px !important;
    max-height: 1200px;
  }
}

@media (max-height: 667px) {
  .full-height{
    max-height:667px;
  }
  .introductie-mobile {
    height: 1200px !important;
    max-height: 1200px;
  }
}

@media (max-height: 568px) {
  .full-height{
    max-height:568px;
  }
  .introductie-mobile {
    height: 1200px !important;
    max-height: 1200px;
  }
}

Answer №3

The top black

<div class="video-section">
adjusts to full height on any device, including iPhones, so the issue does not lie with the height itself.

However, on other devices, the next

<div class="sign-up-banner">
shifts dynamically with a parallax effect as you scroll down. Once you have scrolled past the top black
<div class="video-section">
, the entire second
<div class="sign-up-banner">
becomes fully visible due to JavaScript code. Unfortunately, this JavaScript is not functioning properly on iPhones.

Some CSS properties assigned to the <form> within the <div id="coming-soon"> are still being applied, causing the div to remain stuck behind the first one.

To resolve this, you can use the following CSS:

.sign-up-banner{
    position: static;
    height: auto;
}

#mc_embed_signup form{
    position: static !important;
    -ms-transform: none; /* IE 9 */
    -webkit-transform: none; /* Chrome, Safari, Opera */
    transform: none; 
}

You may wrap this in a media query to specifically target certain screen sizes and apply it to iPhones like so:

@media only screen 
  and (min-device-width: 320px) 
  and (max-device-width: 568px)
  and (-webkit-min-device-pixel-ratio: 2) {
    //insert your css here
}

This will apply the specified CSS to iPhone 4 and 4s models. While it may not be foolproof for excluding all other devices, CSS limitations prevent direct targeting of specific devices. For more guidance on media queries for various devices, refer to https://css-tricks.com/snippets/css/media-queries-for-standard-devices/.

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

Troubleshooting issues with nested NSDictionary and NSArray when using AFNetworking

NSDictionary *customerDictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="147678757c547678757c3a777b79">[email protected]</a>", @"email", @"1", @"facebook", nil ...

Rotate the circular border in a clockwise direction when clicked

I have successfully designed a heart icon using SVG that can be filled with color upon clicking. Now, I am looking to add an outer circle animation that rotates clockwise around the heart as it is being created. Currently, the circle only spins in the code ...

Using Four Different Colour Borders in CSS

Is it possible to create a CSS border with 4 different colors on one side? Currently, I have the following: #header { border-color:#88a9eb; } I aim to achieve a border featuring four solid colors split equally at 25% each. Can this be done? I am looking ...

Enhance your calendar with sleek jQuery styling

Currently, I am utilizing the jQuery-ui.css (smoothness) solely for the calendar CSS. Can anyone provide me with a comprehensive list of all the calendar CSS functions available in it? I'm looking to avoid using any unnecessary CSS that might be causi ...

Transfer a Realm from Bundle to Documents directory, and then store it as a local constant in Swift 2.0

Hey there, I have a pre-populated Realm in my Swift 2.0 project that I want to copy to the Documents directory upon first launch and then use it from there. I've managed to save it to Documents, but for some reason, I can't read it into my let va ...

Resetting the delete button in a UITableView

When a user changes the mode to edit in my UITableView and attempts to delete a row, I perform validations to determine if that row can be deleted. If it cannot, I want to revert the row back to its previous state, without the delete button on the right bu ...

Images are not appearing correctly on Chrome browsers when using Windows operating system

img tags seem to have unusual margins in Chrome, Edge, and Opera browsers, while Firefox displays them correctly. Queries What is causing these margins specifically in Chrome? The Devtool does not detect any margin properties. Is there a straightforward s ...

Slider for comparing images is currently malfunctioning in Firefox

I recently came across a tutorial on how to create an image comparison slider, and it worked flawlessly on Chrome. However, when I tried to load it on Firefox, the slider didn't respond at all. Below is a snippet of the code: const slider = do ...

Symbols duplicated for architectures [arm7, arm64]

I recently updated a framework within my SDK, but I am encountering a frustrating error when trying to build on an iPhone 6 running iOS 9.0.1. The error message is as follows: duplicate symbol _IPDJobStatus in: /Users/akiki/Desktop/iOS 9 Test/MPSDK/iPD.fr ...

What is the method for specifying the HTML file extension within Visual Studio?

I am having issues with my project recognizing the CSS and other files in the HTML files I have created, even though I have double-checked the extension paths. How can I resolve this problem? https://i.stack.imgur.com/85ooE.png https://i.stack.imgur.com/F ...

Modify background color when a column is clicked in a dynamically filled table

I'm in the process of dynamically generating an HTML table as shown below: for (var i = 0; i < rowsToAdd; i++) { var tr = table.insertRow(-1); var colsToAddLength = findColsToAddLength(); for (var j = 0; j < colsToAddLength; j++) { ...

Is there a way to create an <a> element so that clicking on it does not update the URL in the address bar?

Within my JSP, there is an anchor tag that looks like this: <a href="patient/tools.do?Id=<%=mp.get("FROM_RANGE") %>"> <%= mp.get("DESCRITPION") %></a>. Whenever I click on the anchor tag, the URL appears in the Address bar. How can ...

"Troubleshooting a Python MySQL error related to the WHERE clause

As a newcomer to the world of Python, I have recently created a small piece of code to establish a connection to a database and retrieve data from it. In this project, I am utilizing Python version 3.4 along with mysql.connector to facilitate the database ...

Can you insert a query into an HTML value?

Is it possible to include HTML code inside a table row in order to later select it? I have variables hstatus1 and hstatus2, where their meanings are htmlstatus1 and htmlstatus2. It seems to work when filling in words, but not when filling in HTML code. The ...

Is there a way to implement FocusState to dismiss the keyboard by tapping anywhere on the screen, except for the text field itself?

I am sending the FocusState property (focusField) from the TextFieldObservers view to the customTextFieldView using binding. Objective: When tapping on the TextFieldObservers View, the keyboard should be dismissed. Issue: Tapping on the textfield in the ...

Convert an Objective-C app to a Swift app

I currently have an app available in the App Store that was built using Objective-C. I have now created a new Swift project app for the same purpose. Can I simply replace the existing Objective-C app with the updated Swift version as an update? I do not ...

Center the image to always align with the text

I am looking to display an image alongside some text, where the number of text lines can vary. It could be one, two, or three lines of text. Here's how it should be handled: If there is only one line of text: The image should be centered with the te ...

The page remains static even as the function is executed

Having trouble with creating a sliding form using jQuery. The issue is that instead of sliding to the desired page, it slides to a blank one. The website where this problem can be seen is www.entrilab.com. Upon inspecting the element, there are no errors ...

Assign a unique identifier to the Angular mat-checkbox component

I need to attach an ID to an Angular material checkbox. I have an object called item. When I check the HTML code, it shows 'item.id + '-input'. However, when I bind the name, it works fine with just 'item.id'. Below is my current ...

How can we use a generic function in Swift to identify the type of an instance?

There are three classes that adhere to the same object type protocol. class Bicycle: Vehicle {} class Car : Vehicle {} class Truck: Vehicle {} class Bus : Vehicle {} An array is created to hold objects of these classes: let vehicle1 = Car( ...