Which Modernizr css class determines if translateX() can be used?

155 views Asked by At

I'm coding a slide in drawer menu using HTML5, CSS3, jQuery, and Modernizr (for feature detection).

I'm targeting the latest 5 browsers plus IE8 and up, and am using transform: translateX(x) (not supported by IE8) for the drawer animation (slides in from left off-screen.)

I'd like to use Modernizr to detect whether transform: translateX(x) is available but am not sure if transform: translateX(x) is a '2D Transform' or a '3D Transform'.

Question is: which Modernizr CSS class (set in the page <body> tag) should be used?

The Modernizr CSS choices are:

csstransforms or csstransforms3d

1

There are 1 answers

2
BoltClock On BEST ANSWER

translateX() is a 2D transform. MDN does not explicitly state this anywhere, while the now-defunct WebPlatform.org says:

Summary

Transform function for a 2d translation which moves an element on the x-axis by the given value.

and in the css-transforms spec, it's listed under ยง15.1 2D Transform Functions.