The CSS Scroll-Snapping feature seems to be overlooking one specific element that it should be snapping to

Currently, this website is designed to work exclusively for mobile devices. When viewed in Chrome's mobile view using the inspector, everything appears to be functioning correctly. However, when accessed through Safari or on an actual mobile phone, there seems to be a problem where it skips over the second section that it should snap to. Below is the relevant code snippet:

function startGreet(){
  const greets = ["Hey","Hello","Good Morning"];
  const p = document.getElementById('greeting');
  p.innerHTML = greets[Math.floor(Math.random() * greets.length)];
}

/*   If reaches bottom of page do something code

window.onscroll = function(ev) {
    if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {

  }
};
*/
@keyframes jump {
    0% { transform: translate(0,0); }
    20% { transform: translate(0,-95%); }
    40% { transform: translate(0,15%); }
    60% { transform: translate(0,-10%); }
    80% { transform: translate(0,0%); }
    100% { transform: translate(0,0); }
}
body{
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling:touch;
}
html, body{
  position:absolute;
  overflow:auto;
  overflow-x: hidden;
  margin:0;
  height: 100vh;
  width:100%;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  background-color:white;
}
#greeting{
  position:absolute;
  width:100%;
  font-size:75px;
  font-family: 'Roboto Condensed', sans-serif;
  text-align:center;
  margin-top:75%;
  color:black;
}
#slideUp{
  position:absolute;
  height:5%;
  width:100%;
  font-size:70px;
  font-family: 'Roboto Condensed', sans-serif;
  text-align:center;
  margin:0;
  bottom:10%;
  color:#686868;
  -moz-animation: jump 2.5s 3s infinite;
-webkit-animation: jump 2.5s 3s infinite;
    -o-animation: jump 2.5s 3s infinite;
       animation: jump 2.5s 3s infinite;

}

#scrollCont{

  position:absolute;
  overflow: scroll;
  top:0;
  height: 100vh;
  width:100%;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: mandatory;
  scroll-snap-points-y: repeat(100vh);
  scroll-snap-type: y mandatory;
  -webkit-scroll-snap-stop: normal;
  scroll-snap-stop: normal;
}
.row{
  position: relative;
  width:100vw;
  height: 100vh;
  -webkit-scroll-snap-align: start end;
  scroll-snap-align: start end;
  scroll-snap-stop: always;
}
#home{
  position: relative;
  width:100vw;
  height: 100vh;
  -webkit-scroll-snap-align: none;
  scroll-snap-align: none;
}
#flower{
  width:150%;
}







#secondRow{
  color:black;
  word-wrap: break-word;
  background-color:#a0dfff;
  overflow:hidden;
}
#secondRow .title{
  padding-top:5%;
  color:black;
  font-weight: 100;
  font-family: 'Lato', sans-serif;
  font-size: 62.5px;
  margin-left:10%;
  margin-top:5%;

}
#secondRow hr{
  border-color: black;
}
#bodyCont{

  font-size:40px;
  position:relative;
  top:10%;
  left:10%;
  width:80%;
  color:black;
  font-family: 'Lato', sans-serif;
}

#thirdRow{
  background-color:black;
}
#thirdRow .title{
  padding-top:5%;
  color:white;
  font-weight: 100;
  font-family: 'Lato', sans-serif;
  font-size: 62.5px;
  margin:0;
  margin-left:10%;

}
#thirdRow hr{
  border-color: white;
}
<html>
<head>
  <link href="https://fonts.googleapis.com/css?family=Lato:300|Roboto+Condensed&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="mainMenu.css">
<link rel="stylesheet" type="text/css" href="indexR2.css">
<link rel="stylesheet" type="text/css" href="indexR3.css">
<script src="mainMenu.js"></script>
</head>
<body onload="startGreet()">
<div id="scrollCont">
    <div id="home">
    <h1 id="greeting" ></h1>
    <p id="slideUp" >^ ^ ^</p>
  </div>

  <div id="secondRow" class="row">
    <h1 class="title">Introduction</h1>
    <hr>
    <div id="bodyCont">
  <p><i>text text text text text</i></p>
  <img id="flower" src="https://cdn.pixabay.com/photo/2012/04/18/19/18/shrub-37619_640.png"/>
</div>
  </div>

  <div id="thirdRow" class="row">

  <h1 class="title">Introduction</h1>

  </div>

  </div>
  <!--<img id="videos" src="https://www.sccpre.cat/mypng/full/15-156384_old-camera-png-camera-drawing-transparent-background.png"/>-->
</body>
</html>

Please note that this website is intended to function properly only on mobile devices, so viewing it on other devices may result in formatting issues.

Answer №1

Have you considered including the -webkit- prefix for your keyframe? It's important to remember that for Safari on iOS, you will need to use the vendor prefix -webkit- (as outlined on developer.mozilla.org). Here is an example:

@-webkit-keyframes jump {
0% { transform: translate(0,0); }
20% { transform: translate(0,-95%); }
40% { transform: translate(0,15%); }
60% { transform: translate(0,-10%); }
80% { transform: translate(0,0%); }
100% { transform: translate(0,0); }
}

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

Place the Div in a consistent position on images of varying widths

I have a dilemma with my class that is supposed to display images. The issue arises when I try to place a div within an image inside this class. Everything works smoothly when the image takes up the entire width of the class, but as soon as the image widt ...

Applying inline styles in PHP using if/else conditions

I want to customize the appearance of my table based on the status of each entry. Specifically, Completed = Green & Pending = Orange This involves PHP code that retrieves data from a MySQL database. $query = mysql_query("SELECT * FROM cashouts WH ...

Conceal navigation options on smaller screens and enable drop-down menu functionality with Bootstrap 3

With the usage of Bootstrap 3, I have successfully hidden two menu items when the screen is resized. However, these items still appear in the drop down menu that appears on the top left (with three bars) when the screen size is reduced. Is there a way to k ...

Can the default DOM structure of a Jquery Data Table be customized to fit specific needs?

I have incorporated a Jquery Data Table Plugin that can be found at http://datatables.net/api. This plugin comes with its own search box, which is automatically added to the page when enabled. The search box is nested within its own div structure like this ...

Adding a class to the following DIV and smoothly transitioning the current one out can be achieved using a dynamic number of items in multiple instances

Is there a way to create a scalable CSS slideshow for text divs without using images? Here is the current HTML structure: <div class="mb-panel-container cf"> <div class="mb-panel-section mb-slider"> <div class="mb-panel active" ...

I am looking to split an array into smaller subarrays, each containing 5 elements, and assign a distinct class to the elements within each subarray. How can I

I have a group of "n" "li" elements that I would like to split into "x" subsets using jQuery. Each subset should contain 5 "li" elements, and I also want to assign a different class to each subset. <ul> <li>text1</li> <li>text2&l ...

Implementing CSS styles with jQuery

Looking for a way to dynamically add CSS attributes to different form elements like text fields, text areas, checkboxes, and dropdowns? There's also a separate block that lists possible CSS properties such as font, font-style, width, and padding. What ...

What is the reason behind text underline being disabled when using "hidden: overflow" in CSS?

I have a long text string that I want to auto-shorten using CSS with text-overflow: ellipsis, but it's removing the underline from my link. Here is the code: NORMAL .link { font-weight: bold; cursor: pointer; color: black; text-decorat ...

Embed a video clip into an HTML webpage

I attempted to embed a video using HTML. I followed the player script instructions and added the necessary paths and scripts, but unfortunately, the video is not visible on the webpage. Instead, when clicking on the area where the video should be, it opens ...

"Troubleshooting: Why isn't my Tailwindcss box shadow

I'm currently incorporating Tailwindcss into a React project to recreate the Star Wars website mobile menu. However, I am facing an issue where the box shadow added to the hamburger icon segments is not visible when the navigation drawer is opened. A ...

Enhance Material-UI's SwipeableDrawer by incorporating a clickable handle

Is there a way to include a clickable handle in a material ui SwipeableDrawer? Something similar to what's shown on Google Maps here: Google Maps button.css position: absolute; top: 100px; left: -50px; width: 50px; height: 100px; z-index: 10000; // ...

Focusing on the initial element of every line within a flex container that spans multiple lines

Looking for a solution to style the first item on each line of a multiline flexbox container with display: flex; flex-wrap: wrap. Preferably seeking a CSS-only approach rather than Javascript iteration. It's uncertain how many items there will be or t ...

Color-matching cells must be positioned in the same column within the gridbox consecutively

In my current project, I am dealing with a large number of sections. Each section contains one or two rows with columns ranging from 2 to 15, all of equal width. The cells of the same color are placed in the same column, and the layout looks like this: To ...

Bootstrap - Keeping track of the collapse state of <div> elements after page refresh

Looking for some guidance as a javascript/jquery beginner - I am utilizing Bootstrap along with data-toggle and collapse classes to display or hide divs. I have been searching online trying to find a solution that will maintain the state of all divs, wheth ...

Transitioning the font stack from SCSS to JSS (cssinjs)

We are currently implementing a variety of custom fonts with different weights for various purposes. With our entire stack now using Material UI with JSS theming and styling, we aim to eliminate the remaining .scss files in our folder structure. All the f ...

Ensure chip component (div) dynamically resizes its width to accommodate varying lengths of child text elements

I have a main container with two child elements (a text span and an image svg) created using the Material UI component library. My objective is to dynamically adjust the width of the chip based on the length of the text content inside it, while ensuring a ...

What is the best way for me to incorporate images retrieved from an API call into my

Hey everyone, this is my first time posting on here so if there's anything I'm missing, please let me know! I've run into an issue with the images on my categories page not aligning properly and being different sizes after I incorporated som ...

I require displaying the initial three letters of the term "basketball" and then adding dots

Just starting out with CSS and struggling with the flex property. Seems to work fine at larger sizes, but when I reduce the screen size to 320px, I run into issues... Can anyone help me display only the first three letters of "basketball ...

Divs should be of consistent and adjustable height

I am in need of a layout with three columns: left column (with a red background) center column (with a yellow background) right column (with a black background) This is the HTML structure I have in mind: <div id="container"> <div id="left_ ...

Struggling with a CSS problem that jQuery can't seem

I recently experimented with Infogrid on my website. After adding a header and footer, I noticed that the text in the last block of iron man was being cut off. Even though I removed overflow:hidden; from the body and html, the issue persisted with the te ...