$(document).ready(function(){ $(".BloqueoPaxina").click(function(){CerrarPopup()}); $(".Titulo").click(function(){CerrarPopup()}); }); function CerrarPopup(){ $(".BloqueoPaxina").hide(); $(".Popup").hide(); } function centerOnWindow(elemID) { // 'obj' é o obxecto que queremos posicionar var obj = document.getElementById(elemID); var scrollX = 0, scrollY = 0; if(document.body && typeof document.body.scrollTop != "undefined"){ scrollX += document.body.scrollLeft; scrollY += document.body.scrollTop; if(document.body.parentNode && typeof document.body.parentNode.scrollTop != "undefined"){ scrollX += document.body.parentNode.scrollLeft; scrollY += document.body.parentNode.scrollTop } } else if(typeof window.pageXOffset != "undefined"){ scrollX += window.pageXOffset; scrollY += window.pageYOffset; } var x = Math.round((getInsideWindowWidth()/2) - (getObjectWidth(obj)/2)) + scrollX; var y = Math.round((getInsideWindowHeight()/2) - (getObjectHeight(obj)/2)) + scrollY; //Move o elemento á posición calculada. //$(obj).attr("top",x + 'px'); //$(obj).attr("left",y + 'px'); obj.style.left = x- 250 + 'px'; obj.style.top = y - 100 + 'px'; } // Obtén o ancho renderizado dun obxecto. function getObjectWidth(obj){ var elem = document.getElementById(obj); var result = 0; //se non atopamolo elemento, saímos... if (!elem) { return 0; } if(elem.offsetWidth){ result = elem.offsetWidth; } else if(elem.clip && elem.clip.width){ result = elem.clip.width; } else if(elem.style && elem.style.pixelWidth){ result = elem.style.pixelWidth; } return parseInt(result); } // Obtén a altura renderizada dun obxecto. function getObjectHeight(obj) { var elem = document.getElementById(obj); //se non atopamolo elemento, saímos... if (!elem) { return 0; } var result = 0; if(elem.offsetHeight){ result = elem.offsetHeight; } else if(elem.clip && elem.clip.height){ result = elem.clip.height; } else if(elem.style && elem.style.pixelHeight){ result = elem.style.pixelHeight; } return parseInt(result); } // Obtén o ancho do contido nunha fiestra no navegador function getInsideWindowWidth(){ if(window.innerWidth){ return window.innerWidth; } else if(isIE6CSS){ // mide o clientWidth do elemento html return document.body.parentElement.clientWidth; } else if(document.body && document.body.clientWidth){ return document.body.clientWidth; } return 0; } // Obtén a altura do contido nunha fiestra no navegador function getInsideWindowHeight(){ if(window.innerHeight){ return window.innerHeight; } else if(isIE6CSS){ // mide o clientHeight do elemento html return document.body.parentElement.clientHeight; } else if(document.body && document.body.clientHeight){ return document.body.clientHeight; } return 0; } function MostrarInfoWin10Compatible(){ /*$("#dvBloqueo").show(); $("#dvInfo").show(); centerOnWindow("dvInfo");*/ } function MostrarInfoUnionEuropea(){ $("#dvBloqueo").show(); $("#dvInfoUnionEuropea").show(); centerOnWindow("dvInfoUnionEuropea"); } function MostrarInfoMovesII(){ $("#dvBloqueo").show(); $("#dvInfoMovesII").show(); centerOnWindow("dvInfoMovesII"); }