Reputation: 523
Set transform origin property X and Y coordinates struggling to set transform origin property from javascript for both axis.
so from javascript: object.style.transformOrigin = valueX valueY;
Unfortunately, it doesnt work... if i set 2 values it doesnt work.. if i set only 1 value, the valueX is changed only.
What i have done:
newClasses.style.transformOrigin = scaleOrigPoint + "px"; // sets only for valueX
newClasses.style.transformOrigin = (scaleOrigPoint + "px") + (scaleOrigPointY + "px"); // sets only for valueY
newClasses.style.transformOrigin = (scaleOrigPoint + "px") , (scaleOrigPointY + "px"); // doesnt set anything + ERROR
newClasses.style.transformOrigin = (scaleOrigPoint + "px") (scaleOrigPointY + "px"); // doesnt set anything + ERROR
newClasses.style.transformOrigin = [scaleOrigPoint]px; // doesnt set anything + ERROR
And many many other ways... Somethimes it changes the valueY only...
Question:
Is there a way to set bot valueX and valueY for transform origin property using javascript only?
Upvotes: 1
Views: 3460
Reputation: 29906
Have you tried putting a space between them?
newClasses.style.transformOrigin = scaleOrigPoint + "px " + scaleOrigPointY + "px";
Upvotes: 11