The animations in my CSS are not functioning properly on iOS gadgets

I am facing an issue with my CSS and JS code. When I slide down the page, my logo should appear from the left with opacity set to 0. However, when I scroll back up to the top, the logo is supposed to move back to its original position on the left and have its opacity set back to 0. This functionality works fine on computers and Android phones, but it does not work on iOS devices. Can someone help me identify what is wrong with my code?

After sliding up, the logo moves to the left but does not disappear as expected. Thank you in advance for any insights or suggestions.

JS:

const handleToggle = (e) => {
    let brands = document.getElementsByClassName("stickyBrand"); //This refers to my logo.
    if (e) {
      Array.from(brands).forEach((el) => {
        el.classList.add("fadeInLeft");
        el.classList.remove("fadeOutLeft");
      });
    } else {
      Array.from(brands).forEach((el) => {
        el.classList.add("fadeOutLeft");
        el.classList.remove("fadeInLeft");
      });
    }
  };

CSS:

@keyframes fadeInLeft {
  0% {
    opacity: 0;
    transform: translateX(-50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@-webkit-keyframes fadeOutAnimationOperaSafari {
  0% {
    opacity: 0 !important;
    -webkit-transform: translateX(0);
  }
  100% {
    opacity: 1 !important;
    -webkit-transform: translateX(-50px);
  }
}

@keyframes fadeOutAnimation {
  0% {
    opacity: 0;
    -webkit-transform: translateX(0);
    -moz-transform: translateX(0);
    -o-transform: translateX(0);
    transform: translateX(0);
  }
  100% {
    opacity: 1;
    -webkit-transform: translateX(-50px);
    -moz-transform: translateX(-50px);
    -o-transform: translateX(-50px);
    transform: translateX(-50px);
  }
}

Answer №1

Make sure to include -webkit- prefixes in your CSS for transforms. This is important because on iOS, all browsers utilize Safari Webkit (since they are built on UIWebView). Currently, iOS Webkit only recognizes transforms with a prefix.
If you notice that the transform stays at 0 during the animation, it's likely because the non-prefixed selector is not being used.

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

Retrieve every item in a JSON file based on a specific key and combine them into a fresh array

I have a JSON file containing contact information which I am retrieving using a service and the following function. My goal is to create a new array called 'contactList' that combines first names and last names from the contacts, adding an &apos ...

Absolute positioning causes an element's height to increase

As I delve into the realm of typographical animations and seek to calculate the baseline of a font at various sizes, I've stumbled upon a peculiar discovery: It appears that the height values of elements tend to increase in an erratic manner when thei ...

Reactjs: implementing instant state updates

As a Reactjs beginner, I am facing an issue regarding the asynchronous nature of setState(). Despite my understanding that state changes are queued and batched, I have been unable to see immediate updates. I have explored various resources such as the link ...

How come React.js is not displaying images from local URLs?

In my React application, there is a form where users can submit an image file. To store the path of the submitted image locally for browser access, I utilized URL.createObjectURL to generate a URL for the file. Here is the code snippet: handleImageChange(e ...

Is there a way to swap out a div with another using ajax and php?

i am looking to update the content from readmore.php into <div id='box'> based on id_pages in index.php after clicking <a class=readmore> Read More </a>. i have been trying to figure out how to retrieve data from readmore.p ...

Troubleshooting an HTML Design Flaw: How to create a 3x3 table with

I have been attempting to design a HTML page with a 3x3 layout. Despite trying various methods, including divs and tables, I am having difficulty achieving equal spacing around the centered image and the other table rows. Below is an example of the layout ...

Determining the appropriate version of the types package for your needs

It has come to my attention that certain npm packages do not come with types included. Because of this, the community often creates @types/packagename to provide those types. Given that both are packages, how does one determine which version of the types ...

Exploring the "else if" Statements in a JavaScript Calculator

I need help with modifying a calculator created by a former colleague at my workplace. Unfortunately, I haven't been able to contact them and I was hoping someone here could assist me. My knowledge of javascript is limited, so please bear with me if m ...

Setting up the Bootstrap grid structure

Struggling to find the right configuration for this Bootstrap 3 setup... https://i.stack.imgur.com/ZsTdI.png I have an input field, but I'm having trouble placing the image in that position. <div class="row"> <div class="col-sm-4 col-m ...

Developing a notification system using a combination of ajax, jquery, and Iframe

I am in the process of setting up a messaging system on my website. Currently, I have a table with three columns - two integer fields (from and to) and a timestamp for the date of sending. On one section of the page, I want to display a list of messages ...

Troubleshooting problem with HTML5 nodes cloning in Internet Explorer

Is there a way to clone an HTML node using the cloneNode() method of the browser's DOM API or the jQuery clone() function? While the API works well with HTML tags, I am running into issues when using it with HTML5 tags like time. The problem I am fac ...

CSS code that sets the background color to 50% of the window's height

Is it possible to create a background on a webpage that appears to be "split in two" with different colors on opposite sides using linear-gradient, but adjusting for large element(div) heights causing the background color to repeat? <body> <div ...

Effective HTML element placement with CSS styling

My HTML code includes a form containing a table. Take a look: This is the Code I'm Using: <html> <head></head> <body> <form onsubmit="" id="form1" action="" method="post" name="form1" style="position: rela ...

The pseudo right arrow is failing to display in the vertical center

My pseudo right arrow is not displaying vertically centered within the .nav-link class. Can anyone suggest how I can achieve vertical alignment for my right arrow in an <a> tag? I have already attempted using top:50% but it did not work. Here is th ...

Utilizing html5 mode in AngularJS alongside an external NodeJS server

Despite reading numerous SO answers and questions on this topic, I still find myself with lingering uncertainties. To outline the issue: I am utilizing an AngularJS app with html5 enabled to eliminate the '#' sign. $locationProvider.html5Mode( ...

Learning the ins and outs of manipulating arrays using jQuery

I'm currently grappling with arrays in jQuery. I have an array being returned from PHP, where I add elements to the array within a loop like this: $table_data[]= array("id"=>mysql_result($query,$i,"id"),"name"=>trim(mysql_result($query,$i,"name ...

How to use AngularJS to collapse various panels with unique content

Hey everyone, I'm working on developing a collapsible panel using Angular. The panel should consist of a header and body to display the content. The desired behavior is that when a button is clicked, the content collapses down, and clicking the same b ...

Are there any known browser compatibility issues with using "./" (dot slash) before HTML files?

Within the realm of shells, using ./ to indicate the current directory is quite common and generally not perceived as risky when specifying a path. On the other hand, in HTML coding, it's typical to omit ./ and instead directly specify the file name. ...

CSS Float issue on resizing: avoid element displacement due to margin or padding (responsive layout)

Having an issue that I need help with: My header includes a menu, news sliding with flexslider, and a search input: The problem occurs when I resize the browser manually or reload it with a smaller width; the right element jumps down, causing a pushdown ...

Using AngularJS to send a $http.post request with Paypal integration

This form utilizes the standard PayPal format for making purchases. <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="<a href= ...