Problem
The problems with slides are the following:
- The elements appearing at the beginning of a slide stay much longer on screen than those appearing at the end.
- From time to time, we would like to show something that is just slightly bigger than a slide, but does not fit, and separating it in two slides is not really possible.
- The pdf format is very restricted on "interactivity".
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vestibulum neque eu lectus euismod, eget congue massa ultrices. Integer et bibendum sem. Donec neque erat, laoreet et felis vitae, malesuada varius purus. Aenean lacinia tortor id justo consectetur, non volutpat est rhoncus. Praesent eget risus elit. Nullam tempus mi id erat aliquet, sit amet consequat erat volutpat. Phasellus elementum gravida nisl ut auctor. Donec quis massa a mauris tristique interdum gravida ac sem. Aliquam ligula massa, hendrerit et diam sit amet, vulputate consectetur ligula. Phasellus dictum nisl est, quis commodo nunc pellentesque vel. Nulla facilisi. Donec pharetra tellus ut auctor dignissim. Proin convallis ante in pellentesque consectetur. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi tempor sem a lectus ullamcorper fringilla. Maecenas tempor metus mauris, non tincidunt ligula placerat non. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vestibulum neque eu lectus euismod, eget congue massa ultrices. Integer et bibendum sem. Donec neque erat, laoreet et felis vitae, malesuada varius purus. Aenean lacinia tortor id justo consectetur, non volutpat est rhoncus. Praesent eget risus elit. Nullam tempus mi id erat aliquet, sit amet consequat erat volutpat. Phasellus elementum gravida nisl ut auctor. Donec quis massa a mauris tristique interdum gravida ac sem.
Solution!
Slips address this!
Slip.js advanced: fine control of events
- When
slip.js
is loaded, several objects are defined:
-
A variable
engine
which allows to command the window showing the slides. It has the method moveWindow(x, y, scale, rotate, delay)
, moveWindowRelative(dx, dy, dscale, drotate, delay)
.
-
A variable
presentation
which allows to command the presentation. It has the method next()
, nextSlide()
, gotoSlideIndex()
, getCurrentSlide()
, get/setSlides()
, refresh()
.
-
An object
slide
correspond to an HTML element of class slide
. It has the method query(selector)
, queryAll(selector)
, next()
, move{Up;Down;Center}To(selector, delay, offset)
, {reveal;hide}{∅;All}(selector)
, setAction(actionList)
, setNthAction(n, action)
. An action is a function which takes a slide as input.
- The best is to see an example:
let options = { init: (slide) => {}, firstVisit: (slide) => {}, whenLeaving: (slide) => {}};
// the "options" parameter allows to set function to call when document is ready, when entering slide for the first time and when leaving the slide
let intro = new Slide("intro", [], presentation, engine, options);
// We could have specified the actions in the instanciation (instead of [])
intro.setAction([
(slide) => { engine.moveWindowRelative(0,0,1,0,1);
}, (slide) => { engine.moveWindowRelative(0,0,-1,0,1);
}, (slide) => { presentation.nextSlide();
}, (slide) => { slide.revealAll("*");
}]);
let devel = new Slide("devel", [], presentation, engine); // options is optionnal
// We can specify an action for the 5-th "next" of the slide.
devel.setNthAction(5, (slide) => {
slide.query(".random-number").innerText = Math.random();
});
// We can specify an order on slides
presentation.setSlides([intro, devel, intro]);
<div class="slide" id="intro">
<div class="title">Introduction to the subject</div> <!-- for Beamer style title -->
<div class="slide-body-container"> <!-- for Beamer style margin (remove for full-width slips) -->
Blablabla
<!-- avoid including JS in slides -->
</div>
</div>
<div class="slide" id="devel">
<div class="title">Developping the subject</div>
<div class="slide-body-container">
<span class="random-number">Bliblibli</span>
</div>
</div>