Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Imitate CSS3 transition in IE?

I'm using a combination of rules to achieve the CSS3 transition rule in as cross-browser compatible a way as possible: I'm using transition, -webkit-transition, -moz-transition, and -o-transition.

Is there a similar -ms-transition property for any version of Internet Explorer? Is there a proprietary filter for older versions of IE, similar to how the following rules work for opacity in IE 6-8?

/* IE 8 */ 
-ms-filter: "progid:DXImageTransform.Microsoft. Alpha(Opacity=50)"; 
/* IE 5-7 */ 
filter: alpha(opacity=50);
like image 662
daysrunaway Avatar asked Jul 01 '11 05:07

daysrunaway


People also ask

What is css3 transition?

CSS transitions provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect immediately, you can cause the changes in a property to take place over a period of time.

What is difference between transition and transform in CSS?

So, what's the difference between CSS Transform and CSS Transition? The Transform property in CSS moves or modifies the appearance of an element, whereas the Transition property seamlessly and gently transitions the element from one state to another.

Which CSS property is used for transition effect?

The transition-property CSS property sets the CSS properties to which a transition effect should be applied.

What is transition all CSS?

transition: all 1s ease-out; Hover to see. the transition. Transitions enable you to define the transition between two states of an element. Different states may be defined using pseudo-classes like :hover or :active or dynamically set using JavaScript.


2 Answers

There isn't any kind of transition effect in older versions of IE.

The only way that I know of to get anything close to it is to use JQuery's fadeIn() and fadeOut() methods, which do actually work in all versions of IE.

However, I should caution that they still fall foul of IE's notoriously poor opacity handling. JQuery's fade effects can have some weird glitches when used with IE6-8, especially if you're fading a block which contains graphics.

If you decide to try it, the code is dead simple. Simply include JQuery in your headers, and then:

$('#myelement').fadeIn();

in the appropriate place.

See the JQuery FadeIn manual page for further information.

Of course, this would be instead of any CSS transition effect; it's all done through Javascript, and you'd probably need to throw away your CSS3 transitions, or it'll clash with the JQuery effects. But if you want it to work with IE, that's the price you'll pay.

And as I say, watch out for the glitches. Test it, and see how it looks for you.

It's the only way to do it, so if you really need a transition effect in IE, that's what you'll need to do, but be prepared to accept that it may not look all that good.

Other Javascript libraries such as Mootools or Dojo may have similar effects which you could also try, but I would imagine if they do have it, they'd suffer from the same issues.

like image 190
Spudley Avatar answered Sep 28 '22 18:09

Spudley


I ran into this while researching the same question: http://www.useragentman.com/blog/csssandpaper-a-css3-javascript-library/

I also found a library called move.js, which can be used alongside CSS3 transitions: https://github.com/visionmedia/move.js

Hope this helps.

like image 20
user1429980 Avatar answered Sep 28 '22 18:09

user1429980