javascript - Reveal.js 幻灯片无法正常工作

标签 javascript slideshow reveal.js

我正在尝试使用 Reveal.js 框架制作幻灯片,但由于某种原因,它对我不起作用。它只是显示一个空白屏幕。这是我到目前为止所拥有的( jsfiddle ):

    <!DOCTYPE HTML>
    <html>
    <head>
    <link type="text/css" href="http://lab.hakim.se/reveal-js/css/reveal.min.css" rel="stylesheet" media="all">
    </head>

    <body>
    <div class="reveal">
        <div class="slides">
            <section>hello world</section>
            <section>second slide</section>
            <section>third</section>
        </div>
    </div>

    <script type="text/javascript" src="http://lab.hakim.se/reveal-js/js/reveal.min.js"></script>
    </body>
</html>

编辑: 解决办法是在body结束标签前添加如下代码:

<script type="text/javascript">
Reveal.initialize({

// Display controls in the bottom right corner
controls: true,

// Display a presentation progress bar
progress: true,

// Push each slide change to the browser history
history: false,

// Enable keyboard shortcuts for navigation
keyboard: true,

// Enable the slide overview mode
overview: true,

// Vertical centering of slides
center: true,

// Loop the presentation
loop: false,

// Change the presentation direction to be RTL
rtl: false,

// Number of milliseconds between automatically proceeding to the 
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
autoSlide: 0,

// Enable slide navigation via mouse wheel
mouseWheel: false,

// Apply a 3D roll to links on hover
rollingLinks: true,

// Transition style
transition: 'default' // default/cube/page/concave/zoom/linear/fade/none

});
</script>

https://github.com/hakimel/reveal.js

最佳答案

这是因为您在 css 的这一行中将各个部分设置为 display: none:

.reveal .slides>section,.reveal .slides>section>section

使用类似 Firebug 的检查器工具来查看为这些部分设置的 CSS。

关于javascript - Reveal.js 幻灯片无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15719747/

相关文章:

javascript - JS - 如何计算数组中的每个元素?

android - 包含图像和视频的幻灯片

javascript - 使用 CSS 使幻灯片中的照片褪色

html - 使用 reveal.js 在 Quarto 演示文稿标题幻灯片左上角添加小 Logo

javascript - AngularJS,输入文本框甚至不显示

javascript - 将多个数组拆分为字符串,跳过空数组

带有reveal.js : Refresh chart with slide?的Highcharts

javascript - 如何从一个模式窗口文本框中获取值并将其放入另一个模式窗口中的另一个文本框?

javascript - 如何防止自动滚动到聚焦输入?

javascript - jQueryUI 和 SlidesJS 冲突