Below is a script that rotates two images in opposite directions when clicked. One image spins clockwise while the other spins counter-clockwise. The challenge is that each image requires an individual click to rotate. My goal is to make both images rotate with a single click. Any tips or suggestions would be greatly appreciated as I am new to using jQuery.
$(document).ready(function() {
$("#rotate3").click(function() {
if ($(this).css("transform") == 'none') {
$(this).css("transform", "rotate(45deg)");
} else {
$(this).css("transform", "");
}
});
$("#rotate4").click(function() {
if ($(this).css("transform") == 'none') {
$(this).css("transform", "rotate(-45deg)");
} else {
$(this).css("transform", "");
}
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img id="rotate3" src="https://via.placeholder.com/115" width="115" height="115" alt="" />
<img id="rotate4" src="https://via.placeholder.com/115" width="115" height="115" alt="" />