From 29d198def9e4d0c930625d646567e84cc81e512c Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 15 Aug 2016 11:28:48 +0800 Subject: [PATCH] Update slide ready and change event to improve performance --- public/js/slide.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/public/js/slide.js b/public/js/slide.js index e45f78a6..bdd8b3be 100644 --- a/public/js/slide.js +++ b/public/js/slide.js @@ -98,12 +98,15 @@ function renderSlide(event) { markdown.attr('data-rendered', 'true'); document.title = title; Reveal.layout(); - // force browser redraw - setTimeout(function () { - markdown.hide().show(0); - }, 0); } } -Reveal.addEventListener('ready', renderSlide); -Reveal.addEventListener('slidechanged', renderSlide); \ No newline at end of file +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);