I have currently a menu which toggles on/off with a piece of javascript code, when the menu toggles on, there is css thats added to html and body to stop scrolling. Now my issue is that, when the menu toggles off the styles seem to stay so i've added some code so that overflow and height on body and html go back to auto on toggle off.
This presents two problems.
- Menu now no longer toggles on.
Still the initial problem, I need the html and body to go back to its normal scrollable state.
function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block') e.style.display = 'none'; $('html, body').css({ 'overflow': 'auto', 'height': 'auto' }); else e.style.display = 'block'; $('html, body').css({ 'overflow': 'hidden', 'height': '100%' }); }
Would much appreciate all and any help.
Thanks !
ifandelseblocks in braces..