Jump to content
Search Community

Animation in IE8

Jophine 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

Hai,

 

i am facing issues in IE8 browser which have TweenLite.

<!-- MY Javascript Code-->

<script src="../../js/libs/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="../../js/libs/tweenlite/CSSPlugin.min.js" type="text/javascript"></script>
<script src="../../js/libs/tweenlite/TweenLite.js" type="text/javascript"></script>

function startTween(){
	 var bg = document.getElementById("bgHolder");
	 TweenLite.to(bg, 10, {css:{x:500, y:700}});
}
<!-- MY Html Code-->
<button type="button" onclick="startTween()">Start Tween</button>
<div id="bgHolder" style="background-color: #adff2f; width: 200px; height: 200px">
<div id="fgHolder" style="background-color:aqua; width: 50px; height: 50px"></div>
</div>

 

 

 

While running this code in Chrome is working fine but running IE8 its shows something different. my library's are updated, any solution for this

 

my code also in http://jsfiddle.net/jophine/cdWhF/44/

Link to comment
Share on other sites

Hi Jophine,

 

Mainly your problem is that in the css plugin x and y stands for css3 2d transform properties translateX and translateY or translate with an array of values, and those properties are not supported by IE8 and older, just from IE9, something like this:

transform: translate(500px, 700px)
//equals to
TweenLIte.to(bg, 10, {css:{x:500, y:700}});

 

Your solution is to change the css position property of your element to relative or absolute and use top and left, like this:

TweenLite.to(bg, 10, {css:{left:'+=500', top:'+=700'}});

The += before the values indicate that you are adding those amounts to the actual values of top and left of the element.

 

I updated your fiddle so you can check it:

 

http://jsfiddle.net/cdWhF/45/

 

Hope this helps,

Cheers,

Rodrigo.

Link to comment
Share on other sites

Thanks for the help, Rodrigo. Even though those translate props aren't supported in IE8, cssPlugin can still make them work back to IE6

 

Actually, if Jophine just sets position:absolute his x/y syntax will work as shown here:

http://jsfiddle.net/...bassador/vhXYZ/

 

cssPlugin applies the proper margins to get the element to change its position.

Although cumbersome, you can use IE's dev tools to dig into the iframe that jsfiddle creates in the result panel and track down the style attribute of the bgHolder div and see what is happening behind the scenes.

 

At times CSSPlugin will use a matrix filter to get scale and other transforms to work.

Link to comment
Share on other sites

Thanks for the support.

 

when i change the position of the inner div element.

 

<div id="bgHolder" style="background-color: #adff2f; width: 200px; height: 200px; position:absolute;">
<div id="fgHolder" style="background-color:aqua; width: 50px; height: 50px; top:30px; left:50px; position:absolute;"></div>
</div>
var bg = document.getElementById("bgHolder");
TweenLite.to(bg, 10, {css:{x:500, y:700}});
TweenLite.to(bg, 10, {css:{scale:3}});
​

 

 

http://jsfiddle.net/jophine/FLt9X/

 

Any solution for this

Link to comment
Share on other sites

Dear Carl

Thanks for the support

 

but still my problem is not solved.

 

one the above link (filter:inherit). its working but one small problem is there. the inner div position is very in ie8 and chrome (other browsers)

attaching the screen snaps

post-13181-0-82716000-1355405858_thumb.png

post-13181-0-64556500-1355405863_thumb.png

Link to comment
Share on other sites

Hi Jophine,

 

Yes, I see the issue. Thank you for providing the images. Very helpful and I can see the same results in my fiddle.

 

IE8 by any measure is a "broken" browser. Our CSSPlugin is already doing backflips to get even the simplest animations to work. In order for the scale of the parent element to properly change the scale and position of all child elements we would have to loop through all child elements and figure out the proper translations of their scale and position. This would be quite a taxing operation. We would have to do the same for children of children which would compound the performance issues even worse.

 

As of now, and most likely into the future, we can only support transforms of parent elements in IE8. Unfortunately this a problem inherent and unique to IE8 that doesn't have a simple work-around.

 

-c

Link to comment
Share on other sites

Hi,

 

I'm pretty sure that there's a better solution for this, but for what i saw creating a tween for the child element solves the problem in IE but creates quite a mess in any other browser, so what I would do is to use feature detection (http://modernizr.com/ or other) in order to create a code that applies only for IE (what I like to call "painful degradation"), and another that works for the rest of the browsers.

 

Playing with the fiddles i realized that you should check the offset position of the parent and child elements, then use an expression with the relation between both offsets and then a function that updates the offset of the child element as the tween progresses.

 

Now this is a lot of work and before going into that maybe you could put the child div outside the parent and give it a bigger z-index, absolute position and tween it independently and at the same time with the bigger div.

 

Like Carl said the solution is not simple, but depending on what you want to achieve may not be too complicated.

 

Best,

Rodrigo.

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