closing navbar on small devices when page state changes