dontHaveName
dontHaveName

Reputation: 1937

jquery change transform(rotateY)

$("#div").css("transform", "rotateY("+ '+='+90 +"deg)");

I want to increase rotateY, but my syntax is bad, is it possible to fix it?

Upvotes: 2

Views: 6498

Answers (1)

dfmiller
dfmiller

Reputation: 1203

It would be easiest to hold the current rotation in a variable and just increase it's value without having to retrieve the current rotation:

rotation += 90;
$("#div").css("transform", "rotateY("+rotation+"deg)");

Otherwise you will need to parse the css value for transform since it is string.

Upvotes: 4

Related Questions