CSS Transitions and Javascript

If you are using CSS Transitions and want to provide Javascript equivalents to user agents that do not support them, this may help you:


function isCSSAnimCapable() {
    return (
        ("WebkitTransition" in document.documentElement.style) ||
        ("MozTransition" in document.documentElement.style) ||
        ("MsTransition" in document.documentElement.style) ||
        ("OTransition" in document.documentElement.style) ||
        ("Transition" in document.documentElement.style)
    );
}

It does however become a little messy trying to do animation from both Javascript and CSS. You have been warned.

This entry was posted in Code. Bookmark the permalink.

One Response to CSS Transitions and Javascript

  1. Pingback: Alexander7

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>