Skip to content

Commit

Permalink
Fix header animation.
Browse files Browse the repository at this point in the history
  • Loading branch information
KmolYuan committed Apr 20, 2022
1 parent c60d05c commit 30e8854
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/assets/reveal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ background:
option:
hash: true
slide number: c/t
pdf max pages per slide: 1
footer:
src: *gear
width: 50pt
Expand Down
13 changes: 7 additions & 6 deletions src/assets/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
left: 1em;
font-size: 18pt;
opacity: 0.5;
display: none;
}

.footer {
Expand Down Expand Up @@ -259,15 +260,15 @@
if (window.location.search.match(/print-pdf/gi)) {
$('div.slide-background').append($('.top-object'));
setTimeout(function () {
$('div.pdf-page').each((_, e) => $(e).find('.slide-background').append($(e).find('.chapter-header')));
$('div.pdf-page').each((_, e) => $(e).find('.slide-background').append($(e).find('.chapter-header').show()));
}, 1000);
} else {
let target = $('div.reveal');
target.append($('.top-object'));
target.append($(Reveal.getCurrentSlide()).children('.chapter-header'));
let top = $('div.reveal');
top.append($('.top-object'));
top.append($(Reveal.getCurrentSlide()).children('.chapter-header').show());
Reveal.on('slidechanged', e => {
$(e.previousSlide).append(target.children('.chapter-header'));
target.append($(e.currentSlide).children('.chapter-header'));
$(e.previousSlide).append(top.children('.chapter-header').hide());
top.append($(e.currentSlide).children('.chapter-header').show());
});
// Close button
$("#close").click(close_modal);
Expand Down
12 changes: 5 additions & 7 deletions src/project/slides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,11 @@ impl ToHtml for Slide {
+ &md2html(&title_only.wrap("# ", ""))
+ &content.to_html(ctx)
+ &md2html(&note).wrap("<aside class=\"notes\">", "</aside>\n");
let header = if let Some(header) = &ctx.chapter_header {
header
.borrow()
.wrap("<div class=\"chapter-header\">", "</div>")
} else {
String::new()
};
let header = ctx
.chapter_header
.as_ref()
.map(|s| s.borrow().wrap("<div class=\"chapter-header\">", "</div>"))
.unwrap_or_default();
ctx.frag.set(0);
format!("<section{}>\n{}{}</section>", data, content, header)
}
Expand Down

0 comments on commit 30e8854

Please sign in to comment.