我在我的网站上使用 Galleria 幻灯片,但我注意到一个错误似乎非常随机发生。大多数情况下,幻灯片会正确加载,但偶尔会出现此错误:
Uncaught Error: Fatal error: Theme at javascript/themes/classic/galleria.classic.js
could not load, check theme path.
当我重新加载页面时,一切都恢复正常了。这是我用来加载它的代码:
<script>
// Load the classic theme
Galleria.loadTheme('javascript/themes/classic/galleria.classic.js');
</script>
我已经四处搜索,但仍然没有找到有效的解决方案。我个人的想法是有一个脚本可以一直加载直到它成功,因为重新加载页面可以工作。我该怎么做?