Select random accent font on page load
This commit is contained in:
parent
04f0fb83f7
commit
2e3a000f30
|
|
@ -22,4 +22,16 @@ const observer = new IntersectionObserver(entries => {
|
|||
|
||||
document.querySelectorAll('section').forEach(function(section, i) {
|
||||
observer.observe(section);
|
||||
});
|
||||
});
|
||||
|
||||
// Random accent font & color
|
||||
const random = (min, max) => {
|
||||
return Math.floor(Math.random() * (max-min+1) + min);
|
||||
}
|
||||
|
||||
function randomFont() {
|
||||
let randomNumber = random(1, 3);
|
||||
document.documentElement.style.setProperty("--accent-font", `var(--accent-font-${randomNumber})`);
|
||||
}
|
||||
|
||||
randomFont();
|
||||
Loading…
Reference in a new issue