Commit a569e83b authored by Jan-Philipp Stauffert's avatar Jan-Philipp Stauffert
Browse files

Merge branch '47-vertical-slides-3' into 'master'

Add vertical slides

Closes #47

See merge request decker/decker!39
parents c23b191a bdc4fa90
......@@ -4,8 +4,50 @@ require('reveal.js/css/reveal.scss');
require('reveal.js/css/theme/white.css');
require('./decker.scss');
if(window.location.search.match( /print-pdf/gi )){
if (window.location.search.match(/print-pdf/gi)) {
require('reveal.js/css/print/pdf.css');
} else {
require('reveal.js/css/print/paper.css');
}
window.addEventListener('ready', function (event) {
if (Reveal.isReady()) {
makeVertical();
} else {
Reveal.addEventListener('ready', makeVertical);
}
});
function makeVertical() {
const subsections = document.getElementsByClassName("sub");
const subsection_bundles = [];
for (let i = 0; i < subsections.length; i++) {
const subsection = subsections[i];
if (subsection.nodeName !== "SECTION") {
continue;
}
const bundle = [subsection];
while (
i + 1 < subsections.length &&
subsection.nextElementSibling === subsections[i + 1]
) {
i += 1;
bundle.push(subsections[i]);
}
subsection_bundles.push(bundle);
}
for (let bundle of subsection_bundles) {
const supersection = document.createElement("section");
supersection.classList.add("slide");
supersection.classList.add("level1");
const section = bundle[0].previousElementSibling;
section.parentNode.insertBefore(supersection, section);
supersection.appendChild(section);
for (let subsection of bundle) {
supersection.appendChild(subsection);
}
}
Reveal.sync();
Reveal.setState(Reveal.getState());
}
\ No newline at end of file
---
menu: true
---
# First slide
1
# Slide below {.sub}
2
# Even more below {.sub}
3
# To the side
4
# Below again {.sub}
5
# Last one
6
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment