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

214
Visualizações
Why doesn’t my button work when it’s hidden?

I have some code here it is

function setup() {
  createCanvas(1350, 715);
  var blueskin = createButton('BLUE')
  blueskin.mousePressed(changeblue)
  blueskin.position(100,400)
  blueskin.size(50,50)
  blueskin.style('display:none')
}
function changeblue(){
  playercolr='blue'
}
<script src="https://cdn.jsdelivr.net/npm/p5@1.4.1/lib/p5.js"></script>

When the button is not hidden it works perfectly but whenever I change it to hidden it stops working I looked some stuff up and aren’t buttons supposed to work even if hidden

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Change the style from 'display:none' to 'visiblity: hidden' and then try it

visibility:hidden hides the element

display:none removes the element from the document

about 4 years ago · Juan Pablo Isaza Relatório

0

Try:

blueskin.style('display', 'none')

per p5js documentation: https://p5js.org/reference/#/p5.Element/style

The syntax should be style(property, value) rather than style(propertyAndValue)

about 4 years ago · Juan Pablo Isaza Relatório
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