Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting weird rendering issues on Safari #22

Closed
johnend opened this issue May 31, 2017 · 17 comments
Closed

Getting weird rendering issues on Safari #22

johnend opened this issue May 31, 2017 · 17 comments

Comments

@johnend
Copy link

johnend commented May 31, 2017

Hello!

Love the library, works great in Chrome but there is some weird flickering behaviour going on in Safari for some reason. Not 100% why this should be the case, but thought it would be good to let you know.

Website is www.johnenderby.com vanilla-tilt is used on the homepage's middle section.

Would be good to know why it isn't working!

@bastilimbach
Copy link
Contributor

It definitely has to do with the way webkit renders 3D CSS transformations. Take a look at -webkit-backface-visibility: hidden;.
The project demo site works perfectly in Safari.

@micku7zu
Copy link
Owner

Sorry guys, can't help. I don't have any Apple device 😞

@johnend
Copy link
Author

johnend commented Jun 1, 2017

@bastilimbach I tried setting that property but it didn't work, also tried changing a bunch of others, changing the implementation of vanilla-tilt and removing it from my browserify bundle, and everything works fine in Chrome but not in Safari. Seems weird but everything just flickers out of view when mousing over. Are you seeing the same on my site?

@jonahgoldwastaken
Copy link

@johnend I had the same issue on my website, and found out a javascript library I use called ParticlesJS inserts a canvas element which interferes with the 3d transform effect. The only guess I can make is that Safari puts the canvas element and the tilted element on the same point on the z-axis. @micku7zu I don't know how helpful this information is, but maybe you can figure something out. 😬

@johnend
Copy link
Author

johnend commented Jul 3, 2017

I actually found a solution to this on Safari - though it isn't ideal. For the items that were clipping if I added a transform: translateZ to them in their CSS rules the wouldn't clip, unfortunately this means using this rule on anything the should be placed on top of these elements. Not ideal, but works for now.

@nathangc
Copy link

I'm sure it's horrible and buggy but I've found that adding transform: translateZ(-100px); to the canvas element stops my tilt elements from going weird on Safari.

@HFSVBC
Copy link

HFSVBC commented Aug 29, 2017

Hi, I'm having a similar issue with safari. I'm applying the library on a bootstraps thumbnail element and when I hover the element the effect is applied correctly to that part but the onsite sides of the element disappear.
If it helps here is my code:

<div class="row">
	<div class="col-md-4 col-sm-6 col-xs-12 TCT-articlePreview">
		<div class="thumbnail" data-tilt data-tilt-perspective="1000" data-tilt-scale="1" data-tilt-speed="400" data-tilt-max="10" data-tilt-axis="y">
			<img src="<image here>" alt="imagem de apresentação do artigo " title="imagem de apresentação do artigo ">
			<div class="caption">
      				<h3>Thumbnail label</h3>
      				<p>Some text...</p>
      				<p><a href="#" class="btn btn-default" role="button">Button</a></p>
 			</div>
		</div>
	</div>
</div>

screen shot 2017-08-29 at 22 32 30

screen shot 2017-08-29 at 22 32 41

Help please

@micku7zu
Copy link
Owner

Please provide an online demo and I will help you

@thdatnguyen
Copy link

@nathangc you save my day.
Thanks!

@VanDerLars
Copy link

Guys, you should point that out on the readme-page. Took me hours to investigate this bug 🙈

In my case the bug occurs when I have a div with a background-image behind the tilted div.

I'm glad I finally had the glorious idea of looking into the solved issues 😆

@micku7zu
Copy link
Owner

micku7zu commented May 6, 2019

@VanDerLars Done, added this on the Readme page 😄

@VanDerLars
Copy link

Super @micku7zu :)

btw. the bug still exists on safari, if two tilted div lay over each other and the underlying tilted div has an image or a background-image.

you can investigate this here:
https://8bit-world.com/

just open the menu and fiddle around.

@dbartelmus
Copy link

Can confirm that this bug exist, despite different demos and codes which tried to fix it.
Good news is that new Safari in Technology Preview works just fine (as for today).

@GunnarPDX
Copy link

I had this issue and finally figured out what was going wrong. I was using a grainy image background on my webpage behind the tilt element and by adding -webkit-transform-style: preserve-3d; to that background class I was able to get rid of the issue completely on safari.

I have run into similar issues with a .js flip plugin on chrome and It had to do with preserve-3d as well, seems to be a common issue when images can intersect or are covered during transformations. If anyone else runs into this issue I would recommend experimenting with preserve-3d, make sure it's applied to all elements with images being transformed and images behind those aswell.

@mariakhn
Copy link

mariakhn commented Jan 21, 2021

Nothing worked for me. I just added overflow:hidden to main parent element and it worked like a charm in Safari.
Screenshot of code: http://prntscr.com/xd29zs

@estebancasas9817
Copy link

You just need to add this properties:
will-change: transform;
transform: perspective(500px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1);

@qingjiaowoxiaoyi
Copy link

我是给son1添加vanilla-tilt.js后发现问题,你可以尝试使用将overflow:hidden加入到grandfather1

<body>
  <div class="main">
    <div class='grandfather1'>
      <div class='father1'>
        <div class='son1'></div>
      </div>
    </div>
     <div class='grandfather2'>
      <div class='father2'>
        <div class='son2'></div>
      </div>
    </div>
  </div>
</body>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests