added zoom in buttons
This commit is contained in:
@@ -347,6 +347,75 @@
|
||||
// INITIALIZATION
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Initialize zoom control button handlers
|
||||
* Handles close button, show button, and toggle button
|
||||
*/
|
||||
function initZoomControlButtons() {
|
||||
const closeBtn = document.getElementById('zoom-close');
|
||||
const showBtn = document.getElementById('show-zoom-menu-btn');
|
||||
const toggleBtn = document.getElementById('zoom-toggle-button');
|
||||
const zoomControl = document.getElementById('zoom-control');
|
||||
|
||||
// Helper function to toggle zoom visibility
|
||||
function toggleZoom(show) {
|
||||
if (show) {
|
||||
zoomControl.classList.remove('zoom-hidden');
|
||||
if (showBtn) showBtn.classList.add('zoom-hidden');
|
||||
if (toggleBtn) toggleBtn.classList.add('zoom-active');
|
||||
localStorage.setItem('cv-zoom-visible', 'true');
|
||||
} else {
|
||||
zoomControl.classList.add('zoom-hidden');
|
||||
if (showBtn) showBtn.classList.remove('zoom-hidden');
|
||||
if (toggleBtn) toggleBtn.classList.remove('zoom-active');
|
||||
localStorage.setItem('cv-zoom-visible', 'false');
|
||||
}
|
||||
}
|
||||
|
||||
// Close button handler
|
||||
if (closeBtn && zoomControl) {
|
||||
closeBtn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
console.log('Zoom close clicked');
|
||||
toggleZoom(false);
|
||||
});
|
||||
}
|
||||
|
||||
// Show button handler (hamburger menu)
|
||||
if (showBtn && zoomControl) {
|
||||
showBtn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
console.log('Zoom show clicked');
|
||||
toggleZoom(true);
|
||||
});
|
||||
}
|
||||
|
||||
// Toggle button handler (fixed button)
|
||||
if (toggleBtn && zoomControl) {
|
||||
toggleBtn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const isVisible = !zoomControl.classList.contains('zoom-hidden');
|
||||
console.log('Zoom toggle clicked, currently visible:', isVisible);
|
||||
toggleZoom(!isVisible);
|
||||
});
|
||||
}
|
||||
|
||||
// Set initial toggle button state (only active if explicitly 'true')
|
||||
const isVisible = localStorage.getItem('cv-zoom-visible');
|
||||
if (toggleBtn) {
|
||||
if (isVisible === 'true') {
|
||||
toggleBtn.classList.add('zoom-active');
|
||||
} else {
|
||||
toggleBtn.classList.remove('zoom-active');
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Zoom control initialized. localStorage cv-zoom-visible:', isVisible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all CV interactive features when DOM is ready
|
||||
*/
|
||||
@@ -356,6 +425,7 @@
|
||||
initPreferences();
|
||||
initErrorToastClose();
|
||||
initHTMXHandlers();
|
||||
initZoomControlButtons();
|
||||
});
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user