--
This commit is contained in:
@@ -3,11 +3,30 @@
|
||||
const header = document.querySelector('header');
|
||||
if (!header) return;
|
||||
|
||||
const container = document.createElement('div');
|
||||
container.className = 'header-blur';
|
||||
container.setAttribute('aria-hidden', 'true');
|
||||
for (let i = 0; i < 5; i++) container.appendChild(document.createElement('div'));
|
||||
header.prepend(container);
|
||||
const configs = [
|
||||
{ blur: 2, from: '0%', to: '20%' },
|
||||
{ blur: 3, from: '20%', to: '40%' },
|
||||
{ blur: 5, from: '40%', to: '60%' },
|
||||
{ blur: 8, from: '60%', to: '80%' },
|
||||
{ blur: 13, from: '80%', to: '100%' },
|
||||
];
|
||||
|
||||
const root = document.createElement('div');
|
||||
root.className = 'header-blur';
|
||||
root.setAttribute('aria-hidden', 'true');
|
||||
|
||||
let parent = root;
|
||||
for (const cfg of configs) {
|
||||
const layer = document.createElement('div');
|
||||
layer.className = 'blur-layer';
|
||||
layer.style.setProperty('--blur', cfg.blur + 'px');
|
||||
layer.style.setProperty('--from', cfg.from);
|
||||
layer.style.setProperty('--to', cfg.to);
|
||||
parent.appendChild(layer);
|
||||
parent = layer;
|
||||
}
|
||||
|
||||
header.prepend(root);
|
||||
})();
|
||||
|
||||
/* View Transition */
|
||||
|
||||
Reference in New Issue
Block a user