Home › Forums › Design › Load random CSS on page load › Reply To: Load random CSS on page load
November 9, 2016 at 7:57 pm
#247699
Participant
Continuing on Beverley’s example, here’s how you would do it with JS:
<head>
<script>
(function() {
var sheet = document.createElement('link');
sheet.rel = 'stylesheet';
sheet.href = '/path/to/styles/' + (Math.floor(Math.random()*5)+1) + '.css';
document.getElementsByTagName('head')[0].appendChild(sheet);
})();
</script>
</head>