iOS devices are not displaying the background image as intended

I've searched through previous answers on the SO platform, but I'm still unable to find a solution that works for me. I have a static Gatsby site with an infinite scrolling background implemented on desktop, and a static image displayed on mobile. The strange issue is that this problem only occurs on the landing page, while other pages work fine. This problem arises after deployment, even though everything seems fine during development using Safari. My CSS styling resembles a plate of spaghetti as I've been trying various approaches without success...

Here's my code:


import React from "react";
import './index.scss';
import Navbar from '../components/camconavbar.js';
import BackgroundImage from '../../static/Untitled-1.jpg';
import Particles from '../components/particles.js';
import ParticleCamCo from '../../static/CamCo(solid).svg';
import { motion, AnimatePresence } from 'framer-motion';
import { Link } from 'gatsby';

const Home = ({ isVisible }) => {
  return (

    <div className="container">

    <motion.div className="intro-nav" initial={{opacity: 0}} animate={{opacity: 1}} transition={{duration: 5, delay: 17}}>
        <Navbar className="intro-nav" />
    </motion.div>
        <Particles />
        <motion.div className="logo-container" initial={{opacity: 1}} animate={{opacity: 0}} transition={{duration: 1, delay: 5}}>
          ...

My SCSS file:


html body {
  margin: 0;
  padding: 0;
}

@media only screen and (max-width: 800px) {
  .nav-item {
    display: none;
  }
}
...

If anyone can provide some guidance, it would be highly appreciated!

Answer №1

It's a bit tricky to determine if these settings are the complete solution without seeing the HTML for the landing page navigation. However, it might be worthwhile to check out these configurations (and possibly others).

@media only screen and (max-width: 768px) {
  .mobile-landing-nav {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
  }
}

@media only screen and (min-width: 768px) {
  .mobile-landing-nav {
    display: none;
  }
}

In the case of an IOS device with dimensions of 768x1024, it will satisfy both conditions, and the one that hides the navigation is the one that takes precedence. Is this deliberate?

There are other considerations as well:

@media only screen and (min-width: 768px) {
  .background-container img {
    display: none;
  }

This configuration would also apply to a 768x1024 device, blurring the line between mobile and non-mobile design.

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

Automatically populate a jQuery dropdown box with MySQL data

I have a scenario where I need to create 2 dropdown boxes. The first dropdown box will display all the tables from a database, and when a table is selected, the second dropdown box should be populated with fields from that specific table. Dropdown Box 1: ...

Utilizing chart.js data source plugin in React application (react2chartjs)

Upon receiving inspiration from a question regarding importing data from Excel and presenting it as charts using ChartJs (Import data from Excel and use in Chart.js), I was able to successfully achieve this goal. However, my attempt to replicate this proce ...

Troubleshooting: Why isn't my Bootstrap glyphicon icon displaying

Has anyone encountered issues with the glyphicon icon not showing up on buttons in Safari or Chrome when using Bootstrap? I tried fixing it but couldn't. Any help would be greatly appreciated! <link href="css/bootstrap.min.css" rel="stylesheet"&g ...

reacting to user key press by listening to the window and triggering a

import React, { Component } from 'react'; import './App.css'; import Manoeuvre from '../Manoeuvre/Manoeuvre'; import Box from '../Box/Box'; class App extends Component { constructor(){ super(); this.state ...

Display One Div at a Time in Sequence on Page Load Using jQuery

I have come across this question multiple times: How to Fade In images on page load using JavaScript one after the other? Fade in divs sequentially Using jQuery .fadeIn() on page load? Despite trying various recommended methods, I'm still unable t ...

What components does Flex have? And how do they compare to HTML elements?

In the realm of flexibility, creating and reusing components can be a powerful tool. In this case, the ability to code a component once, style it, and then reuse it in various instances is invaluable. The beauty lies in the independence of each copy produc ...

Assistance needed with incorporating an additional link button into the extensive menu

I recently checked out the impressive mega menus featured on the w3schools website. You can find them here: (https://www.w3schools.com/howto/howto_css_mega_menu.asp). While using the "try it yourself" option, I tried to experiment with adding another mega ...

Having trouble accessing the latest version of the ReactJS single page application in Chrome

Our application is built on ReactJS and deployed using S3 and CloudFront. We are experiencing an issue where clients often need to perform a hard refresh of the web app to access the latest Single Page Application (SPA). In order to address this problem, ...

Enliven the character limit reaction by incorporating a thrilling shake animation when it reaches

I have implemented a feature in my component where if a user reaches the character limit, the component should shake. However, despite my efforts, the shaking effect is not working in the current code. const useStyles = makeStyles(() => ({ shake ...

Issue with PHP and HTML Character Interactions

My variable looks like this: $name=' 18 " LCD TV '; When attempting to use it in an HTML input, the characters after the " do not display. Any suggestions on how to fix this issue? ...

What is the best way to vertically align a container beneath a navbar without triggering the appearance of a scrollbar?

I'm in the process of developing an application using Bootstrap 4. The app features a navigation bar and a container located beneath it. Below you'll find the structure of the application: <body> <div id="root"> ...

Utilizing Next.js Image Component to Apply CSS for Width and Height Settings

Currently, I am utilizing the Image component provided by Next.js, which requires setting specific width and height values. To address this, I am incorporating Tailwind CSS utility classes to establish the desired dimensions. <Image src={imageSr ...

Are you looking to add some flair to your Flexbox layout using Media

I am in the process of developing a website using flexbox, and one key aspect of the design is to hide the navigation bar, specifically the left panel in this JSFiddle, when the viewport width is between 480px and 1023px. The current implementation achieve ...

Looking to display a page header alongside an image on the same page

I'm currently learning React.js and working on my very first app. As someone new to frontend development, I am aiming to have a header design similar to that of popular websites like StackOverflow or YouTube, where an image or icon is positioned just ...

Is there a way for me to define the type of a prop based on the type of another prop?

I'm not entirely certain how to phrase this inquiry, or which terminology to employ, so I'll do my best in presenting it. My intention is to develop a component that functions on an array of elements and triggers a render function for each eleme ...

``The `npm ci` command is designed to install packages only when there is synchronization between your package.json and package-lock.json or npm-shrinkwrap.json files

I'm encountering an issue with my react app when the GitHub actions are running as CI for builds. npm ERR! npm ci can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file ...

Struggling to contain the image inside my div element

I'm having trouble with keeping the image inside my div element as it keeps stretching outside of it. I've tried researching for a solution but haven't been successful in finding one. Any help would be greatly appreciated! Here is the HTML/ ...

What are the best practices for integrating PrimeVue with CustomElements?

Recently, I decided to incorporate PrimeVue and PrimeFlex into my Vue 3 custom Element. To achieve this, I created a Component using the .ce.vue extension for the sfc mode and utilized defineCustomElement along with customElements.define to compile it as a ...

Expanding the `div` element to visually occupy the entire vertical space

I'm facing a design challenge with my webpage layout. I have a fixed header and footer, but I need the content section to dynamically adjust its height between the two. The goal is to fill the remaining vertical space with a background-image in the co ...

What could be causing certain items in my Bootstrap navbar to be hidden on mobile screens?

When I view my website on mobile devices, only the logo appears in the navbar, not the other elements. Can you help me troubleshoot this issue? NavBar HTML Code: .navbar-logo { width: 93.75px; height: 23.5px; margin-left: 10rem; } .navba ...