I am trying to rotate right this image on click
Every click, the image will rotate 90 degrees right, so 4 clicks will get it to the original position.
For some reason assigning the class (rotateimg90) to the image doesn't work.
function rotate90(){
alert('rotate!')
$('.theImage').addClass('rotateimg90');
}
.btn-floating-container {
top:50px;
left:50px;
position: fixed;
}
.btn-floating {
width: 150px;
height: 50px;
border-radius: 50%;
text-align: center;
padding: 0px;
font-size: 24px;
}
.rotateimg90 {
-webkit-transform:rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="btn-floating-container">
<button class="btn-floating btn btn-primary btn-medium" onclick="rotate90()">ROTATE</button>
</div>
<img id="theImage" src="https://images.unsplash.com/photo-1533467915241-eac02e856653?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80" />