Select random accent font on page load
This commit is contained in:
parent
04f0fb83f7
commit
2e3a000f30
|
|
@ -23,3 +23,15 @@ const observer = new IntersectionObserver(entries => {
|
||||||
document.querySelectorAll('section').forEach(function(section, i) {
|
document.querySelectorAll('section').forEach(function(section, i) {
|
||||||
observer.observe(section);
|
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