Skip to content

Instantly share code, notes, and snippets.

@HashRaygoza
Created December 4, 2021 23:25
Show Gist options
  • Save HashRaygoza/7637b5b39d42407aee65ff8224f088a6 to your computer and use it in GitHub Desktop.
Save HashRaygoza/7637b5b39d42407aee65ff8224f088a6 to your computer and use it in GitHub Desktop.
"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