When you switch pages, the state reverts to its original state. ademiguel is right, the best way to pass the information that nav bar is collapsed or not is the url.