Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda