How to set -moz-transition property from JavaScript?

I want to implement

-moz-transition: text-shadow 0.25s ease-in-out,font-size 0.25s ease-in-out;

via javascript. What is the syntax for this?

+3
source share
3 answers

In raw JavaScript, this is:

document.getElementById("yourElem").style.MozTransition = "text-shadow 0.25s ease-in-out,font-size 0.25s ease-in-out";

Note. The preceding hyphen causes an uppercase letter in JavaScript: -moz=>Moz

+12
source

Use element.style.MozTransition = "text-shadow 0.25s ease-in-out,font-size 0.25s ease-in-out". Example: http://jsfiddle.net/m9Hpc/3/

+2
source

There is another way that may be useful in some cases:

var vendor = detectVendor(); // or hardcode the string "-moz-"
element.style[vendor + "transition"] = "text-shadow 0.25s ease-in-out,font-size 0.25s ease-in-out"
0
source

All Articles