When making the page work without JS I removed a class from the body which made loading the page change behaviour.
I have added a line in javascript to add the class back. It will load before the rest of the javascript gets loaded.
It works as intended again.
I also removed a css file that shouldn't have been in the initial commit.