Reputation: 147
How can I have the arrows rotate onclick and rotate back when I slide open another menu or click on the arrow again?
JS:
//Dropdown Menu
$("a.slide-dropdown").click(function slideMenu()
{
$(this).next('ul').slideToggle();
$(this).parent().siblings().children().next('ul').slideUp();
});
//Arrows
$( ".crossRotate" ).click(function() {
//alert($( this ).css( "transform" ));
if ($(this).css( "transform" ) == 'none' )
{
$(this).css( "transform" , "rotate(-180deg)" );
}
else
{
$(this).css("transform","" ) ;
}
});
Upvotes: 0
Views: 563
Reputation: 1691
You need to update your crossRotate click
event.
Try this
//Arrows
$( ".crossRotate" ).click(function() {
//alert($( this ).css( "transform" ));
$(".crossRotate").css("transform","none" ) ;
if ($(this).css( "transform" ) == 'none' )
{
$(this).css( "transform" , "rotate(-180deg)" );
}
else
{
$(this).css("transform","none" ) ;
}
});
Upvotes: 1