I have the following function which works fine when only one instance of the image being rotated:
// Next Angle Variable
nextAngle = 0;
$( ".portfolioDropLink" ).click(function() {
// Icon Variable
var currentIcon = $(this).find(".fa-angle-down");
// Rotate Icon
currentIcon.rotate(getNextAngle());
function getNextAngle() {
nextAngle += 180;
if(nextAngle >= 360) {
nextAngle = 0;
}
return nextAngle;
}
});
When two instances of the .portfolioDropLink
class are present the nextAngle
variable clashes, how can I prevent this?