javascript - Menu only "clickable" once -


i have menu div opacity 0, visibility hidden initially. essentaially want div made available on click of div ( menu sticks top of page, discoverable/hide-able via click).

this works great.... one time...

i can click "#menuicon" , menu availble. can click , hidden. menu forever hidden , not become available again. me fix this??

jquery code /* discovers menu on clicks */ $('#menuicon').click(function () {     if ($('#menu ul').css('visibility') == 'hidden') {         $('#menu ul').css('visibility', 'visible');         $('#menu ul').animate({             opacity: 1         }, 500);     } else {         $('#menu ul').animate({             opacity: 0         }, 500,         function () {             $('#menu ul').css('visibility', 'hidden');         });     } }); 

in animate script, forget close parentheses in proper location should fix it:

$('#menuicon').click(function () {     if ($('#menu ul').css('visibility') == 'hidden') {         $('#menu ul').css('visibility', 'visible');         $('#menu ul').animate({             opacity: 1         }, 500);     } else {         $('#menu ul').animate({             opacity: 0         }, 500,         function () {             $('#menu ul').css('visibility', 'hidden');         }); } }); 

also, note jsfiddle friend. use tidy script , check errors in script


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -