这个问题涉及reveal.js
库,但更可能只是一般的JavaScript问题。我有一些HTML加载reveal.js
库。如果我从https://cdn.jsdelivr.net/reveal.js/2.6.2
加载它,一切正常。我想做一些自定义主题,所以我试图运行reveal.js
的本地副本,但是,当我从https://github.com/hakimel/reveal.js克隆reveal.js
repo并将其放在我的HTML旁边,确保所有链接也相应地更改,它不起作用(没有文本渲染)。如果我查看Chrome中的JavaScript控制台,我会得到:
Uncaught ReferenceError: Reveal is not defined Lecture1.slides.html:29623 (anonymous function)
答案 0 :(得分:1)
Reveal.js在我当地运行完全没问题只需几行:
<script src="reveal.js/lib/js/head.min.js"></script>
<script src="reveal.js/js/reveal.js"></script>
<script>
//run reveal.js
Reveal.initialize({
controls: true,
progress: true,
theme: Reveal.getQueryHash().theme || 'moon',
transition: Reveal.getQueryHash().transition || 'slide',
dependencies: [
{ src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>