2016-05-12 159 views
0

當我滑動打開另一個菜單或再次單擊箭頭時,如何讓箭頭旋轉onclick並向後旋轉?當菜單切換時箭頭旋轉

JSFIDDLE

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","") ; 
} 
}); 

回答

1

你需要更新你的crossRotate click事件。

試試這個

//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") ; 
    } 
});