AI update: שדרוג לדף הדמו של 'Hair On Top' (מספרה/עיצוב שיער):
1) תמונות: בכל מקום שיש placeholder או חוסר תמונה — הוסף תמונות סטו
This commit is contained in:
@@ -104,4 +104,82 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Sale Popup
|
||||
const popup = document.getElementById('salePopup');
|
||||
const popupClose = document.getElementById('popupClose');
|
||||
const popupButtons = popup ? popup.querySelectorAll('.popup-option-btn, .popup-link') : [];
|
||||
|
||||
// Check if popup was already shown in this session
|
||||
const popupShown = sessionStorage.getItem('popupShown');
|
||||
|
||||
function showPopup() {
|
||||
if (popup && !popupShown) {
|
||||
popup.classList.add('active');
|
||||
document.body.style.overflow = 'hidden';
|
||||
sessionStorage.setItem('popupShown', 'true');
|
||||
|
||||
// Focus trap
|
||||
const focusableElements = popup.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
||||
const firstFocusable = focusableElements[0];
|
||||
const lastFocusable = focusableElements[focusableElements.length - 1];
|
||||
|
||||
firstFocusable.focus();
|
||||
|
||||
popup.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Tab') {
|
||||
if (e.shiftKey) {
|
||||
if (document.activeElement === firstFocusable) {
|
||||
e.preventDefault();
|
||||
lastFocusable.focus();
|
||||
}
|
||||
} else {
|
||||
if (document.activeElement === lastFocusable) {
|
||||
e.preventDefault();
|
||||
firstFocusable.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function hidePopup() {
|
||||
if (popup) {
|
||||
popup.classList.remove('active');
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Show popup after 5 seconds
|
||||
if (!popupShown) {
|
||||
setTimeout(showPopup, 5000);
|
||||
}
|
||||
|
||||
// Close popup events
|
||||
if (popupClose) {
|
||||
popupClose.addEventListener('click', hidePopup);
|
||||
}
|
||||
|
||||
if (popup) {
|
||||
popup.addEventListener('click', function(e) {
|
||||
if (e.target === popup) {
|
||||
hidePopup();
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape' && popup.classList.contains('active')) {
|
||||
hidePopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Button click handlers (just close popup for demo)
|
||||
popupButtons.forEach(function(btn) {
|
||||
btn.addEventListener('click', function() {
|
||||
// In a real implementation, these would link to actual actions
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user