Created
December 4, 2021 23:25
-
-
Save HashRaygoza/7637b5b39d42407aee65ff8224f088a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
class Dialogo { | |
constructor() { | |
// Obtenemos los objetos relevantes del documento | |
this.overlay = document.getElementById("overlay"); | |
this.btn = document.getElementById("botonDialogo"); | |
this.span = document.getElementsByClassName("botonCerrar")[0]; | |
// le asignamos a cada boton una funcion qie se llamara al presionar | |
this.btn.addEventListener("click", this.mostrar().bind(this)); | |
this.span.addEventListener("click", this.ocultar().bind(this)); | |
} | |
mostrar() { | |
let f = function() { | |
this.overlay.style.display = "block"; | |
}; | |
return f; | |
} | |
ocultar() { | |
let f = function() { | |
this.overlay.style.display = "none"; | |
}; | |
return f; | |
} | |
} | |
export { Dialogo }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment