Jump to content
Search Community

background size does not work properly in ios/ipads

frankofamerica test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I don't really know what's wrong with using backgroundSize. It may not be supported on Safari for the ios you are testing on.

You can achieve the same effect that works on ios by adding your image in another container with overflow set to hidden,

then position your image at top 0 and left 0, and then in your TweenMax increase width and height to 125% which gives the

same effect.

 

Take a look at this codepen:

See the Pen EygZLX?editors=1111 by RedGlove (@RedGlove) on CodePen

  • Like 1
Link to comment
Share on other sites

background-size is supported on Safari.. you might need to also use the vendor prefix for background-size for Safari 3.0 and below:

"-webkit-background-size": "+=25% +=25%",
backgroundSize: "+=25% +=25%",

Safari has the following limitations and known issues:

  1. Safari (OS X and iOS) and Chrome do not support background-size: 100% <height>px; in combination with SVG images, it leaves them at the original size while other browsers stretch the vector image correctly while leaving the height at the specified number of pixels.
  2. iOS Safari has buggy behavior with background-size: cover; + background-attachment: fixed;
  3. iOS Safari has buggy behavior with background-size: cover; on a page's body.

For a kens burns effect i would recommend just using transform scale instead, since even width and height can be choppy, especially in Firefox and Chrome when animating up to higher width and height values, even with autoRound: false on Windows 7 and 10. And transform scale can take advantage of using the GPU to animate smoother. Just make sure when using scale that the image is already at its largest size so you can work around a webkit anti-alias bug that makes images and text blurry when scaled above a scale factor of 1.

 

Resource:

background-size: https://developer.mozilla.org/en-US/docs/Web/CSS/background-size

 

:)

  • Like 2
Link to comment
Share on other sites

It looks like the problem was that Safari reports the computed style in a funky way, omitting the 2nd value when it matches the first. So if you set backgroundSize to "100% 100%" and then ask the browser for the computed value, it'll say it's simply "100%" (no 2nd value). GSAP was defaulting the 2nd value to 0. I've updated the next version of GSAP so that it'll just copy the first value in this case. You can preview the uncompressed TweenMax with this in place at https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/TweenMax-latest-beta.js - does that work better for you? 

  • Like 2
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...