i have button on site has jquery changes css of other elements on click.
i want assign function reverse css changes when button clicked second time.
$('.mobileitem').click(function(){ $('.bottomfooter').css("bottom","75px"); $('#mobilefoot').css("display", "block"); }); i want able click .mobileitem again , have css change bottom:0 display:none respective elements.
each time click .mobileitem should go between two.
i think .toggle() not sure of proper syntax or if there better way
$('.mobileitem').click(function(){ var bot_val="75px"; var dis_val="block"; if($('.bottomfooter').css("bottom")==bot_val){ bot_val="0px"; } if($('#mobilefoot').css("display")==dis_val){ dis_val="none"; } $('.bottomfooter').css("bottom", bot_val); $('#mobilefoot').css("display", dis_val); }); this should work!
Comments
Post a Comment