execute function when certain slide appear in reveal.js

前端 未结 2 1731
旧时难觅i
旧时难觅i 2021-02-04 08:08

I create a presentation with this javascript framework http://lab.hakim.se/reveal-js/#/ and when certain slide is appearing I want to execute function stats(), which display som

2条回答
  •  一整个雨季
    2021-02-04 08:23

    To answer Philippe Leefsma's question: you can use bind() to pass arguments, like so:

    drawDiagramOnSlide.bind(
        null,
        slideName,
        slideEl.querySelector('.diagram')
    ));
    

    Assuming drawDiagramOnSlide looks like this:

    function drawDiagramOnSlide(_slideName, _diagramEl, _event) {...}
    

    The bind call will create a function that calls drawDiagramOnSlide with the correct slide name and element (in my case, a div with class diagram inside the slide ).

提交回复
热议问题