While Reveal itself is not built into this functionality, it allows you to configure event hooks to perform actions when all slides are loaded, which means JQUERY TO THE RESCUE!
You can combine the Reveal event "All slides are ready" with simple javascript to reorder all section s, here's a simple PoC:
Import jQuery first, I did this by adding it directly above the import for js / discovery.min.js:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
Then configure the event listener:
Reveal.addEventListener('ready', function(event) { // Declare a function to randomize a jQuery list of elements // see http://stackoverflow.com/a/11766418/472021 for details $.fn.randomize = function(selector){ (selector ? this.find(selector) : this).parent().each(function(){ $(this).children(selector).sort(function(){ return Math.random() - 0.5; }).detach().appendTo(this); }); return this; }; // call our new method on all sections inside of the main slides element. $(".slides > section").randomize(); });
I put this right after declaring Reveal settings and dependencies, but I'm sure you can put them anywhere.
What this does is wait for all javascript, css, etc. to load, manually reorder the slides in the DOM, and then let Reveal start doing its job. You should be able to combine this with all of your other placement settings, as it does nothing destructive to prove itself.
As for the “shuffling them every time” part, the easiest way would be to use another event listener, slidechanged . You can use this listener to check if there was only the last transition with the previous slide, after which you can simply refresh the page with the next slidechanged call.
You can do this with something like:
var wasLastPageHit = false; Reveal.addEventListener('slidechanged', function(event) { if (wasLastPageHit) { window.location.reload(); } if($(event.currentSlide).is(":last-child")) {
Kasra Rahjerdi Jul 17 '14 at 17:46 2014-07-17 17:46
source share