The button flashed briefly when loading the page. This was even more obvious when using devices with slow internet connections. Using CSS instead of JavaScript to hide the menu solves the issue, since styles are loaded before scripts.