rookie here. i am using basic javascript, css to open/close div by clicking/unclicking on checkbox.
function toggleMenu (divId, box) {
var vis = (box.checked) ? "block" : "none";
document.getElementById(divId).style.display = vis;
}
how do i keep the state of the javascript effect. right now if i click on checkbox to open the div and if i refresh the page or hit back, the page would load with checked box but closed div.
many thanks in advance.
Cookies would (in my opinion) be the best method of doing this. Check this out: http://www.w3schools.com/JS/js_cookies.asp
—
When a user checks/unchecks the menu, it can create/change the cookie.
Have an onLoad event check their cookies for the menu_open variable: