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

212
Visualizações
Change from click to reveal to keyup (bonus if I can designate a specific key)

Current script is:

<script data-name="Incremental IO" data-version="v0.1">
    var observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            if (!mutation.addedNodes) return
            if ((rect = document.querySelector(".closet-rect")) != null) {
                incrementalIO(rect)
                observer.disconnect()
            }
        })
    })
    observer.observe(document.getElementById("qa"), {
        childList: true,
        subtree: true
    })
    function incrementalIO(first) {
        for (rect of document.querySelectorAll(".closet-rect.is-active")) {
            rect.classList.remove("is-active")
        }
       activate(first)
    }
    function activate(rect) {
        rect.classList.add("is-active")
        rect.addEventListener("click", reveal)
    }
    function reveal() {
        this.classList.remove("is-front")
        this.classList.add("is-back")
        if ((next = this.nextElementSibling) != null) {
            activate(next)
        }
    }
</script>

When I change the .addEventListener to "keyup", I still have to click on the object before it allows the keyup function to work. This defeats the purpose of removing the click to reveal. Is there a way that I can automatically have the object(s) selected for the keyup to work? Ideally, I would like to specify one key to do this, but I'd settle for any at the moment.

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