我在下面编写了代码来翻转图像。我正在设置-webkit-transform=rotateY(180deg)
,但再次在click
我想将图像恢复到原始位置的事件中。我尝试-180
了价值,但它不起作用。
var status=1;
function flipIt(obj) {
//$(obj).wrap("<div class='centerImage'></div>")
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)");
//$(obj).css("box-shadow","-5px 5px 5px #aaa");
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);
}
}
请帮忙。