Skip to content

Instantly share code, notes, and snippets.

@flavioso16
Last active July 4, 2016 19:40
Show Gist options
  • Save flavioso16/fe7c437deceefcecd9c3de2626c1c277 to your computer and use it in GitHub Desktop.
Save flavioso16/fe7c437deceefcecd9c3de2626c1c277 to your computer and use it in GitHub Desktop.
(function(){
var styleModal = document.createElement("link");
styleModal.type = "text/css";
styleModal.rel = "stylesheet";
styleModal.href = "https://s3-sa-east-1.amazonaws.com/sba-support-files/Superare/style-modal-argos.css";
document.head.appendChild(styleModal);
styleModal.onload = function () {
// inclusão da modal no body
var divModal=document.createElement("div");divModal.setAttribute("id","modal-cadastro-sucesso"),divModal.setAttribute("class","modal-argos");var divModalContent=document.createElement("div");divModalContent.setAttribute("class","modal-argos-content"),divModalContent.setAttribute("style","width: 400px;"),divModal.appendChild(divModalContent);var divModalClose=document.createElement("div");divModalClose.setAttribute("class","modal-argos-close"),divModalClose.appendChild(document.createTextNode("x"));var divModalMsg=document.createElement("div");divModalMsg.setAttribute("class","modal-argos-msg");var pTxt=document.createElement("p");pTxt.appendChild(document.createTextNode("Cadastro efetuado com sucesso!")),divModalMsg.appendChild(pTxt),divModalContent.appendChild(divModalClose),divModalContent.appendChild(divModalMsg),document.getElementsByTagName("body")[0].appendChild(divModal);
// definição de funções openArgosModal e closeArgosModal
var modal = document.getElementById('modal-cadastro-sucesso');var btn=document.getElementById("btn-open");var btnClose = document.getElementsByClassName("modal-argos-close")[0];if(btn){btn.onclick = function(){openArgosModal();}};btnClose.onclick=function(){closeArgosModal();};window.onclick=function(event){if(event.target==modal){closeArgosModal();}};window.openArgosModal=function openArgosModal(){modal.style.display="block";};window.closeArgosModal=function closeArgosModal(){modal.style.display = "none";};
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment