impress.js is a new web presentation written using Javascript. I want to create custom events to go to the next page. For example, I might create a “Next” and “Previous” button.
The entire impress.js file is a function, calling selectPrev(); from within the function will go to the next page. However, I’m not very good with Javascript, I don’t know how to call selectPrev(); from outside the function.
The file can be found here: https://github.com/bartaz/impress.js/blob/master/js/impress.js
By the looks of it, the whole file is inside a closure, and
selectNextis local to that closure. Additionally, it is only used indirectly in the key listener, so getting it from there is also impractical.Thus, without modifying the source, I do not see any easy way to get at
selectPrev/selectNext.Here is the message from a commit about six hours ago:
It seems the developer is planning to add a proper API soon. If you wait a little, there should be some standard, sanctioned and (hopefully) documented way to interact with
impress.jsprogramatically.If you just want a quick hack, you could always have your button trigger a key event. If you’re using jQuery, you can do it like this:
38will go to the next slide and40to the previous.