位置:在reveal.js中修复

fun*_*dry 17 position fixed reveal.js

我正在尝试为我的reveal.js演示文稿制作一个标题,它位于屏幕顶部.标题中的内容在每个幻灯片的基础上是动态的,因此我必须将标记放在section标记内.

显然,如果标记位于section标记内,则position.js中的position:fixed实际上并不能提供令人满意的结果.我无法弄清楚为什么会这样,但我在github repo中发现了一些信息,建议将显示大小设置为适合视口大小:

Reveal.initialize {
    ...
    width: '100%',
    height: '100%',
    ...
}
Run Code Online (Sandbox Code Playgroud)

但它仍然不适合我 - 似乎演示文稿并没有真正受到上述影响.这是一个演示:

https://dl.dropboxusercontent.com/u/706446/_linked%20stuff/reveal.js/index.html

任何想法如何解决这个问题?

rof*_*rol 9

将此添加到css:

.reveal.slide .slides > section, .reveal.slide .slides > section > section {
  min-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  position: absolute !important;
  top: 0 !important;
  align-items: center !important;
}
section > h1, section > h2 {
  position: absolute !important;
  top: 0 !important;
  margin-left: auto !important;
  margin-right: auto !important;
  left: 0 !important;
  right: 0 !important;
  text-align: center !important;
}
.print-pdf .reveal.slide .slides > section, .print-pdf .reveal.slide .slides > section > section {
  min-height: 770px !important;
  position: relative !important;
}
Run Code Online (Sandbox Code Playgroud)


小智 5

在 main.html 的末尾添加:

Reveal.initialize({ center: false, })