Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

191
Visualizações
Chrome ignores `filter: hue-rotate(...)` if argument is `attr(...)`

I have set up a small site where the background color changes as you scroll. I used the following code to set a data-scroll attribute on the html element:

const debounce = (fn) => {
    let frame;

    return (...args) => {
        if (frame)
            cancelAnimationFrame(frame);

        frame = requestAnimationFrame(() => fn(...args));
    };
};

const storeScroll = () => {
    document.documentElement.dataset.scroll = window.scrollY;
};

document.addEventListener('scroll', debounce(storeScroll), { passive: true });

storeScroll();

and the following css to change the background color:

h1 {
    /* Add some height to the page */
    padding-bottom: 10000000px;
}

html {
    background: #f00;
    filter: hue-rotate(attr(data-scroll));
}

Chrome DevTools shows me this, with no information.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda