Jump to content
GreenSock

Mauro

IE8 opacity

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

Hi,

I need to animate a text with 3d effect + fading, ensuring compatibility (al least for fading) back to IE8. But I hae some problems. Consider the following example:

 

<div id="text">BLA BLA BLA</div>

TweenMax.to($("#text"), 2, {opacity:0, z:0.1, rotationX:360, rotationY:360});

 

IE10+ doed the 3d animation + fading

IE9 does the fading

IE8 does the fading

 

but if I use the following tween

TweenMax.to($("#text"), 2, {opacity:0, x:1, z:0.1, rotationX:360, rotationY:360});

 

IE10+ doed the 3d animation + fading

IE9 does the fading

IE8 doesn't fade!

 

I can't understand why adding x:1 the opacity has no effect.

 

The same happens with the following lines

TweenMax.to($("#text"), 2, {alpha:0, x:1, z:0.1, rotationX:360, rotationY:360}); // IE8 doesn't fade
TweenMax.to($("#text"), 2, {alpha:0, z:0.1, rotationX:360, rotationY:360});  // IE8 does the fade
 
With the following line IE8 does the fade but IE10+ does not the 3d effect
TweenMax.to($("#text"), 2, {css:{alpha:0}, x:1, z:0.1, rotationX:360, rotationY:360});
 

 

Thank you!

Link to comment
Share on other sites

Hello and Welcome to GreenSock Forums Mauro!

  • also are you seeing this in IE8 standalone or are you seeing this in a different IE versions rendering document mode?
  • have you looked into using autoAlpha

CSSPLUGIN DOCs - autoAlpha:

 

http://api.greensock.com/js/com/greensock/plugins/CSSPlugin.html

 

autoAlpha - the same thing as "opacity" except that when the value hits "0", the "visibility" property will be set to "hidden" in order to improve browser rendering performance and prevent clicks/interactivity on the target. When the value is anything other than 0, "visibility" will be set to "inherit". We don't set it to "visible" in order to honor inheritance (imagine the parent element is hidden - setting the child to visible explicitly would cause it to appear when that's probably not what was intended). And for convenience, if the element's visibility is initially set to "hidden" and opacity is 1, it will assume opacity should also start at 0. This makes it simple to start things out on your page as invisible (set your css visibility:hidden) and then fade them in whenever you want.

 

Can you make a limited

See the Pen by pen (@pen) on CodePen

or jsfiddle with your issue so we can see what your HTML, JS, and CSS.. so we can better help see what your seeing in IE8.

 

thx :)

Link to comment
Share on other sites

Yes, a codepen or any example would be quite helpful.

 

I did a little test and am seeing the opacity work fine in IE8 using your tween props: {opacity:0, x:1, z:0.1, rotationX:360, rotationY:360}.

Please open this page in IE8:

http://codepen.io/GreenSock/full/mHali

 

 

The codpen editor doesn't work in IE8, but here you can see exactly what html, css and js I am using: http://codepen.io/GreenSock/pen/mHali

 

As Jonathan pointed out, its important to test in the real IE8 as switching browser/document mode in newer IEs is not 100% accurate.

  • Like 1
Link to comment
Share on other sites

Thanks for your reply. I don't think jsfiddle and codepen support IE8. So I made a simple script you can see here:

 

http://gosite.it/tm/test.php

 

I made the following 8 tests (i'm using IE11 changing the rendering mode)

 

<div id="text1">BLA BLA BLA</div>
<div id="text2">BLA BLA BLA</div>
<div id="text3">BLA BLA BLA</div>
<div id="text4">BLA BLA BLA</div>
<div id="text5">BLA BLA BLA</div>
<div id="text6">BLA BLA BLA</div>
<div id="text7">BLA BLA BLA</div>
<div id="text8">BLA BLA BLA</div>   
 
TweenMax.to($("#text1"), 2, {opacity:0, z:0.1, rotationX:360});
TweenMax.to($("#text2"), 2, {opacity:0, x:1, z:0.1, rotationX:360});
TweenMax.to($("#text3"), 2, {alpha:0, z:0.1, rotationX:360});
TweenMax.to($("#text4"), 2, {alpha:0, x:1, z:0.1, rotationX:360});
TweenMax.to($("#text5"), 2, {css:{alpha:0}, z:0.1, rotationX:360});
TweenMax.to($("#text6"), 2, {css:{alpha:0}, x:1, z:0.1, rotationX:360});
TweenMax.to($("#text7"), 2, {autoAlpha:0, z:0.1, rotationX:360});
TweenMax.to($("#text8"), 2, {autoAlpha:0, x:1, z:0.1, rotationX:360});

 

With IE 10+ all tests do the fade, but with 5 and 6 the rotationX doesn't start

With IE 9 all tests fades, no one do the 3d transformation

With IE 8 the 2 and 4 tests doesn't fade

 

I would like a Tween that is able to perform the transformation (x:1, z:0.1, rotationX:360) and fading in IE10+ and just fading in IE8/9. I can find one only without x:1. This is soo strange.

 

Thanks

Link to comment
Share on other sites

This is happening because your 5 and 6 GSAP to() is using the css:{} object..

 

Since you are including the css {} object you need to put the css properties x, z, and rotationX inside the css:{} object:

TweenMax.to($("#text5"), 2, {css:{alpha:0, z:0.1, rotationX:360}});
TweenMax.to($("#text6"), 2, {css:{alpha:0, x:1, z:0.1, rotationX:360}});

Notice how x, z, and rotationX are inside the css:{}

 

http://api.greensock.com/js/com/greensock/plugins/CSSPlugin.html

 

Here is a codepen you can test.. codepen will work in IE8 in FULL mode only:

 

See the Pen uLEcm by jonathan (@jonathan) on CodePen

 

Hope this helps! :)

  • Like 4
Link to comment
Share on other sites

Just to extrapolate on the IE8 issue you mentioned:

 

You won't be getting a perfect recreation of IE8 using IE11 with a changed document mode. We have encountered issues before with testing complex animation (and yes, opacity is 'complex' in IE8) with emulated IE8. If you don't have access to a computer with the actual IE8 installed, Microsoft offers free VMs for this testing. Otherwise, you might have better luck with IETester, although its still has a few quirks of its own. Actual IE8 is what your users will be using, so it pays to test on the real thing.

  • Like 2
Link to comment
Share on other sites

Many thanks guys!

I installed IETester and both your and my script work correctly on IE8

M

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.
×