function wmModalWindow (container) { this.container = container; this.overlayClass = 'overlay'; this.bodyClass = 'content'; this.mainCont = document.querySelector('#'+this.container); this.overlay = this.mainCont.querySelector('.'+this.overlayClass); this.content = this.mainCont.querySelector('.'+this.bodyClass); this.closeButton = document.createElement("button"); this.timerTime = 300; this.init = function () { _this = this; this.overlay.addEventListener('click', function(e) { _this.hide(); }); this.closeButton.classList.add('close'); this.closeButton.addEventListener('click', function(e) { _this.hide(); }); this.content.appendChild(this.closeButton); } this.show = function () { _this = this; /* window.scrollY */ if (window.getComputedStyle(this.mainCont).position == 'absolute') { if (window.scrollY > 50) this.mainCont.style.top = window.scrollY + 'px'; else this.mainCont.style.top = 50 + 'px'; } this.mainCont.classList.add('is-visible'); var overlay_timer = setTimeout(function() { _this.overlay.classList.add('is-visible'); var content_timer = setTimeout(function() { _this.content.classList.add('is-visible'); }, _this.timerTime); }, 10); } this.hide = function () { _this = this; this.content.classList.remove('is-visible'); var overlay_timer = setTimeout(function() { _this.overlay.classList.remove('is-visible'); var mainCont_timer = setTimeout(function() { _this.mainCont.classList.remove('is-visible'); }, 300); }, this.timerTime); } } /*
*/ /* if (document.querySelector('.indexOrderModalForm')){ var indexOrderModalForm = new wmModalWindow ('indexOrderModalForm'); indexOrderModalForm.init(); } */