jquery - return image back to the original position after a 180 degree rotation -


i have written code below flip image . setting -webkit-transform=rotatey(180deg), again on click event want bring image original position. tried -180 value it's not working.

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);     } } 

please help.

try setting 0, not minus 180.

$(obj).css("transform","rotatey(0deg)"); 

then won't rotate think it's calculated relative original rotation.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -