-
Notifications
You must be signed in to change notification settings - Fork 0
/
flexcol.mosaic.demo.js
37 lines (32 loc) · 1.15 KB
/
flexcol.mosaic.demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(function (window, document) {
'use strict';
var configHash = [{
className: 'cols-2',
columns: 2
}, {
className: 'cols-3',
columns: 3
}, {
className: 'cols-4',
columns: 4
}, {
className: 'cols-5',
columns: 5
}],
containerClassName = 'flexcol-container',
containerSelector = '.' + containerClassName,
container = document.querySelector(containerSelector),
headline = document.getElementById('columns-count'),
mosaic = new window.FlexcolMosaic(),
activeConfig = configHash[1];
window.setInterval(function () {
var configs = configHash.filter(function (config) {
return config.columns !== activeConfig.columns;
});
activeConfig = configs[Math.floor(Math.random() * configs.length)];
container.className = containerClassName;
headline.innerHTML = activeConfig.columns;
container.classList.add(activeConfig.className);
mosaic.setColumns(activeConfig.columns);
}, 5000);
})(window, window.document, window.console);