I am having trouble with rotating an image using code. I have tried setting
-webkit-transform=rotateY(180deg)
and want to bring the image back to its original position on a click
event. However, when trying to use rotateY(-180deg)
, it is not working as expected.
var status = 1;
function flipIt(obj) {
console.log("value before Function status " + status);
if (status == 1) {
$(obj).css("-webkit-transform-style", "preserve-3d");
$(obj).css("-webkit-transition", "all 1.0s linear");
$(obj).css("transform-style", "preserve-3d");
$(obj).css("transition", "all 1.0s linear");
$(obj).css("-webkit-transform", "rotateY(180deg)");
$(obj).css("transform", "rotateY(180deg)");
status = 0;
console.log("after if value set status " + status);
} else {
$(obj).css("-webkit-transform-style", "preserve-3d");
$(obj).css("-webkit-transition", "all 1.0s linear");
$(obj).css("transform-style", "preserve-3d");
$(obj).css("transition", "all 1.0s linear");
$(obj).css("-webkit-transform", "rotateY(-180deg)");
$(obj).css("transform", "rotateY(-180deg)");
status = 1;
console.log("ater else value set status " + status);
}
}
Any assistance would be greatly appreciated.