javascript - Function almost complete - Need to make it close -
what missing? trying make function close, have working opening, can't figure out how make close using same code applies open...
javascript:
$(document).ready(function(){ $('a.head').click( function(){ var = $(this) ; var section = $( a.attr('href') ); section.removeclass('section'); $('.section').hide(); section.addclass('section'); if(! section.is(':visible') ){ section.fadein(400); }; }); });
edit:
$(document).ready(function(){ $('a.head').click( function(){ var = $(this) ; var section = $( a.attr('href') ); section.removeclass('section'); $('.section').hide(); section.addclass('section'); if(! section.is(':visible') ){ section.fadein(400); }; else(! section.is(':visible') ){ section.fadeout(400); }; }); });
you need
if( section.is(':visible') ){ section.hide() } else{ section.fadein(400); };
Comments
Post a Comment