Update slide ready and change event to improve performance

This commit is contained in:
Wu Cheng-Han 2016-08-15 11:28:48 +08:00
parent 8124d6f2d6
commit 29d198def9

View file

@ -98,12 +98,15 @@ function renderSlide(event) {
markdown.attr('data-rendered', 'true'); markdown.attr('data-rendered', 'true');
document.title = title; document.title = title;
Reveal.layout(); Reveal.layout();
// force browser redraw
setTimeout(function () {
markdown.hide().show(0);
}, 0);
} }
} }
Reveal.addEventListener('ready', renderSlide); Reveal.addEventListener('ready', function (event) {
renderSlide(event);
var markdown = $(event.currentSlide);
// force browser redraw
setTimeout(function () {
markdown.hide().show(0);
}, 0);
});
Reveal.addEventListener('slidechanged', renderSlide); Reveal.addEventListener('slidechanged', renderSlide);