Shuffle splashpage highlights

(cherry picked from commit 1101c3c9497766a498422ce5c5bfe797a52cf840)
This commit is contained in:
James Mason 2018-03-21 19:21:39 -07:00 committed by Henne Vogelsang
parent 60847e1dae
commit 988803b601
2 changed files with 14 additions and 1 deletions

View file

@ -31,6 +31,19 @@ $(function () {
});
});
/**
* Randomize order of parallel elements by shuffling the decks
* Adapted from https://stackoverflow.com/questions/7070054
*/
$(document).ready( function() {
$.each($(".shuffle-deck"), function(index, deck) {
for(var i = deck.children.length; i >= 0; i--) {
deck.appendChild(deck.children[Math.random() * i | 0]);
}
});
});
$(".select-help-toggle").change(function () {
var id = $(this).attr('id');
$('.' + id).collapse('hide');

View file

@ -4,7 +4,7 @@
Program Highlights
.row
.col-md-12
.row.row-centered
.row.row-centered.shuffle-deck
- highlights.each do |event|
- speaker = event.speakers_ordered.first
.col-md-3.col-sm-3.col-centered.col-top.highlights