Elijah Rangel
Contact: [email protected]
document.addEventListener('DOMContentLoaded', function () { let currentZoom = 0.5; let baseWidth = 0; const BASE = 0.5; const overlay = document.getElementById('resumeOverlay'); const content = document.getElementById('resumeContent'); const img = document.getElementById('resumeImage'); const label = document.getElementById('zoomLevel'); const openBtn = document.getElementById('resumeOpenBtn'); const closeBtn = document.getElementById('resumeCloseBtn'); const zoomInBtn = document.getElementById('zoomInBtn'); const zoomOutBtn = document.getElementById('zoomOutBtn'); if (!overlay || !content || !img || !label || !openBtn || !closeBtn || !zoomInBtn || !zoomOutBtn) { return; } function applyZoom() { if (!baseWidth) return; img.style.width = (baseWidth * currentZoom) + 'px'; const percent = (currentZoom / BASE) * 100; label.textContent = Math.round(percent) + '%'; } function setBaseWidth() { const isMobile = window.innerWidth <= 768; const contentWidth = content.clientWidth || window.innerWidth; if (isMobile) { baseWidth = contentWidth * 1.9; } else { baseWidth = Math.min(window.innerWidth * 0.96, 1300); } applyZoom(); } function openResumePopup() { overlay.style.display = 'flex'; setBaseWidth(); content.scrollTop = 0; content.scrollLeft = Math.max((img.offsetWidth - content.clientWidth) / 2, 0); } function closeResumePopup() { overlay.style.display = 'none'; } function zoomInResume() { if (currentZoom < 3) { currentZoom += 0.1; applyZoom(); } } function zoomOutResume() { if (currentZoom > 0.2) { currentZoom -= 0.1; applyZoom(); } } openBtn.addEventListener('click', openResumePopup); closeBtn.addEventListener('click', closeResumePopup); zoomInBtn.addEventListener('click', zoomInResume); zoomOutBtn.addEventListener('click', zoomOutResume); overlay.addEventListener('click', function (e) { if (e.target === overlay) { closeResumePopup(); } }); window.addEventListener('resize', function () { if (overlay.style.display === 'flex') { setBaseWidth(); } }); if (img.complete) { setBaseWidth(); } else { img.addEventListener('load', setBaseWidth); } });