How to create a slideshow that plays automatically

30 views
Skip to first unread message

Falko

unread,
Jun 4, 2014, 3:57:41 AM6/4/14
to web...@googlegroups.com
In order to create a slide show that automatically goes from one slide (or in webpager terms views, which is a subpage) to another you have to do the following.

In the left menu open up the Page Configuration. Go to the section where it says "Here you can define the order of views [...]". Now the correct order of all you views. You can test if this is correct by exiting the Page Configuration and using your cursor keys on the keyboard.

Now we need to insert the code for the auto-play. In the edit mode open up the hacker-shell with the command ctrl+m and switch to the JS tab. Paste in the following code snippet:

t = undefined; // store the timer function in here
timer_is_on
= false; // check if the timer was started already
intervall
= 8000; // change in milliseconds
slideHeartBeat
= function() {
 
if (timer_is_on) {
    app
.router.nextView(); // transition to next view
    t
= setTimeout("slideHeartBeat()", intervall); // start the next timer, executes in 8000 ms
 
}
}
// start the timer on click of an object
$
('#view').on('click', '#obj1234', function() {
 
if (!timer_is_on) {
    timer_is_on
= true;
    slideHeartBeat
();
 
}
});


The code snippet start the automatic slide show in click of an object, so the last thing we need to do is to find out the object id (in the example above it ist #obj1234).

To do this click on the object (your start button image) in the editor and look in the right menu in the section Link. There you find something like 
Address of this element:
./home#9712
the number after the # is your object id. This means in our code above we should replace #obj1234 with #obj9712

You must now click save in hacker-shell to store the new code. 

Almost done! Reload you page and click on the start button to start the presentation. 
Reloading is advised since if you pressed save several times while working on the JavaScript code the timer would start several times which might cause strange effects.

If you are interested in having individualized transition times for each view let me know and I will explain how to do this.
Reply all
Reply to author
Forward
0 new messages