Because I had added Bootstrap 4 and other external files I was getting CSP errors in the Chrome developer console. When I created a module to whitelist them the problem with Bootstrap 4 CSS causing fotorama to disappear after 2 seconds has now completely been fixed for me.