CSSTranslate: CSSTranslate() constructor
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The CSSTranslate() constructor creates a
new CSSTranslate object representing the translate() value of the
individual transform property in CSS.
Syntax
new CSSTranslate(x, y)
new CSSTranslate(x, y, z)
Parameters
x-
A value for the x-axis of the
CSSTranslateobject to be constructed. This must be a<length-percentage>. y-
A value for the y-axis of the
CSSTranslateobject to be constructed. This must be a<length-percentage>. zOptional-
A value for the z-axis of the
CSSTranslateobject to be constructed. This must be a<length>.If a value is passed for the
z-axisthis is a 3d transform. The value ofis2Dwill be set to false.
Exceptions
TypeError-
Raised if the value of
CSSTranslate.xorCSSTranslate.yis not a<length-percentage>. TypeError-
Raised if the value of
CSSTranslate.zexists but is not a<length>.
Examples
To do
Specifications
| Specification |
|---|
| CSS Typed OM Level 1> # dom-csstranslate-csstranslate> |
Browser compatibility
Loading…