(function mostrarBannerPopUp() {
const imageUrl = '/cnt/ads/20260910_110257_iamimnoraim.jpg';
const targetUrl = '/roshhashana';
// 1. Crear el fondo oscuro (overlay)
const overlay = document.createElement('div');
Object.assign(overlay.style, {
position: 'fixed',
top: '0',
left: '0',
width: '100vw',
height: '100vh',
backgroundColor: 'rgba(0, 0, 0, 0.75)',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
zIndex: '999999',
opacity: '0',
transition: 'opacity 0.3s ease'
});
// 2. Contenedor de la imagen y botón
const container = document.createElement('div');
Object.assign(container.style, {
position: 'relative',
maxWidth: '90%',
maxHeight: '90%'
});
// 3. Enlace alrededor de la imagen
const link = document.createElement('a');
link.href = targetUrl;
link.style.display = 'block';
// 4. Elemento de imagen
const img = document.createElement('img');
img.src = imageUrl;
Object.assign(img.style, {
width: '100%',
maxHeight: '85vh',
objectFit: 'contain',
borderRadius: '8px',
boxShadow: '0 4px 20px rgba(0,0,0,0.5)',
cursor: 'pointer'
});
// 5. Botón de cierre (X)
const closeBtn = document.createElement('button');
closeBtn.innerHTML = '×';
Object.assign(closeBtn.style, {
position: 'absolute',
top: '-15px',
right: '-15px',
width: '35px',
height: '35px',
backgroundColor: '#ffffff',
color: '#333333',
border: 'none',
borderRadius: '50%',
fontSize: '24px',
fontWeight: 'bold',
cursor: 'pointer',
boxShadow: '0 2px 8px rgba(0,0,0,0.3)',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
lineHeight: '1',
zIndex: '10'
});
// Función para cerrar el pop-up con animación
const cerrarPopUp = () => {
overlay.style.opacity = '0';
setTimeout(() => overlay.remove(), 300);
};
// Eventos de cierre
closeBtn.addEventListener('click', (e) => {
e.stopPropagation(); // Evita que se active el enlace al hacer clic en cerrar
cerrarPopUp();
});
overlay.addEventListener('click', (e) => {
if (e.target === overlay) cerrarPopUp();
});
// Ensamblar elementos
link.appendChild(img);
container.appendChild(link);
container.appendChild(closeBtn);
overlay.appendChild(container);
document.body.appendChild(overlay);
// Forzar reflow para animación de entrada
setTimeout(() => overlay.style.opacity = '1', 10);
// Temporizador para cierre automático a los 10 segundos
setTimeout(cerrarPopUp, 10000);
})();