jquery - color variable in animation doesn't work -
i don't see it. want change color of button animation. first click works second not. checked var c , gets rgb color correctly evidently don't give correctly animation.
var grey2 = "#555"; $(".mainmenu .fa-search").click(function() { var c = $( ).css("color"); if ( == 0) { $(".mainmenu .searchform").slidedown(); $( ).animate({color: grey2}); = 1; } else { $(".mainmenu .searchform").slideup(); $( ).animate({color: c}); = 0 };
when second time click change color grey2(#555) var c has #555 both equal.
that's why second time not working
try code
var grey2 = "#555"; var c = $(".mainmenu .fa-search").css("color"); $(".mainmenu .fa-search").click(function() { if ( == 0) { $(".mainmenu .searchform").slidedown(); $( ).animate({color: grey2}); = 1; } else { $(".mainmenu .searchform").slideup(); $( ).animate({color: c}); = 0 }; });
Comments
Post a Comment