jquery rotate image onclick

前端 未结 7 695
难免孤独
难免孤独 2020-12-17 10:30

I am trying to achieve this (90 degree rotation), but it fails without errors. This image is within a TAG where it has already a toggle jque

7条回答
  •  春和景丽
    2020-12-17 11:09

    Use a combination of css rules -webkit-transform and -moz-transform on image click.For example to rotate image by 90 degree apply following css rules on click

    $('img').click(function(){
        $(this).css({
            "-webkit-transform": "rotate(90deg)",
            "-moz-transform": "rotate(90deg)",
            "transform": "rotate(90deg)" /* For modern browsers(CSS3)  */
        });
    });
    

提交回复
热议问题