Jump to content
Search Community

Another zIndex Safari issue with ScrollTrigger =(

DemonEX test
Moderator Tag

Recommended Posts

Hello, colleagues,


I'm faced with another one mobile Safari issue. 

This is how it should work and it work in any other browsers => https://youtube.com/shorts/ShZ4IlI2AEI

This is how it works in mobile Safari => https://youtube.com/shorts/r5BSIsRKXZk


Short version of my code is below:

      initMobile(triggerBlock, animatedCards, animDuration, idx) {
        const cards = this.$gsap.utils.toArray(animatedCards)
        const timeline = this.$gsap.timeline({ paused: true })
        cards.forEach((card) => {
          timeline.to(card, {
            y: 0,
            x: 0,
            z: 0,
            transformPerspective: 30,
            boxShadow: '0px 0px 13px rgba(0, 0, 0, 0.3)'
        const config = {
          trigger: triggerBlock,
          start: 'top top',
          end: '+=' + animDuration,
          pin: true,
          scrub: true,
          animation: timeline


I already tried a lot of options: with different z-indexes (i know about this Safary's "feature"), with "fromTo", with "to", animating "yPercent", "y" only. The final version is with x/y/z animation to force "transform3d". Nothing is helpful :(

I have no any other ideas. Could you please help?




Link to comment
Share on other sites

First of all, it's important to understand that Safari renders 3D things in a completely different way than all other browsers in terms of z. There's nothing we can do about that - you just have to build things with that in mind which basically means assuming that the "z" position dictates stacking order (Safari often ignores z-index if you've got 3D transforms applied). 


Aside from that, it's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or Stackblitz that demonstrates the issue? 


Please don't include your whole project. Just some colored <div> elements and the GSAP code is best. See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer.


Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen


Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 


Please share the StackBlitz link directly to the file in question (where you've put the GSAP code) so we don't need to hunt through all the files. 


Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites



The problem is that iOS has some issues with webcontainer, the technology Stackblitz uses is not compatible with all iOS browsers 😞


I created a Nuxt 2 project with the same code in my local machine and connected my iPad to it through my local network and it works exactly as it does on desktop on Safari and Chrome, so maybe I'm missing something here 🤷‍♂️


Happy Tweening!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...