Answers for "rotate image onclick with animation css"

CSS
4

Rotate an image on hover CSS

<input class = "spin" type="image" src="(IMAGE URL)" width="42" height="42" alt="a" title"Transform 360 deg. image!">

<style>
.spin:hover {
height: 60px;
width: 60px;
transition: .5s;
transform: rotate(360deg);
}
</style>

<!-- You can remove the height and width elements in the CSS style tag if you wish. -->
Posted by: Guest on March-13-2021
0

rotate icon on click css

/*it would be easier to do this with CSS transitions:*/

/* CSS */
.rotate{
    -moz-transition: all 2s linear;
    -webkit-transition: all 2s linear;
    transition: all 2s linear;
}

.rotate.down{
    -ms-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
    transform: rotate(180deg);
}

/*jQuery*/

$(".rotate").click(function(){
    $(this).toggleClass("down"); 
});
Posted by: Guest on July-05-2021

Browse Popular Code Answers by Language