Rotate image with onclick

后端 未结 6 1520
遥遥无期
遥遥无期 2020-12-10 23:47

I try to make a toggle button where my image (an arrow) will be rotated by 180 degrees each click:



        
6条回答
  •  情话喂你
    2020-12-11 00:29

    You may write like this. demo

    jQuery(document).ready(function(){
       var deg_temp =45;
      jQuery("#image1").click(function(){
         deg_temp = deg_temp+30;
      jQuery(this).rotate(deg_temp);
      })
    
    });
    

提交回复
热议问题