Add translations for cookie consent and footer links in multiple languages; update checkout consent messages
- Updated French, Italian, Dutch, and US English translations to include cookie consent messages and footer links. - Modified checkout consent messages to include privacy policy acceptance. - Added new pages for cookies, contact, returns, and complaints with appropriate styling and content. - Updated routing in index.php to include new pages. - Refactored image selection script to use click events instead of mouseover.
This commit is contained in:
34
script.js
34
script.js
@@ -1,43 +1,15 @@
|
||||
if (document.querySelector('.product-img-small')) {
|
||||
let imgs = document.querySelectorAll('.product-img-small img');
|
||||
let mainImg = document.querySelector('.product-img-large img');
|
||||
let originalSrc = mainImg.src; // Store the original image source
|
||||
|
||||
imgs.forEach(img => {
|
||||
img.onmouseover = () => {
|
||||
img.onclick = () => {
|
||||
// Update main image
|
||||
document.querySelector('.product-img-large img').src = img.src;
|
||||
// Update selection
|
||||
imgs.forEach(i => i.parentElement.classList.remove('selected'));
|
||||
img.parentElement.classList.add('selected');
|
||||
};
|
||||
// On mouse out - restore to the original image
|
||||
img.onmouseout = () => {
|
||||
mainImg.src = originalSrc;
|
||||
imgs.forEach(i => i.parentElement.classList.remove('selected'));
|
||||
// Optionally re-select the original thumbnail
|
||||
imgs.forEach(i => {
|
||||
if (i.src === originalSrc) {
|
||||
i.parentElement.classList.add('selected');
|
||||
}
|
||||
});
|
||||
};
|
||||
img.onclick = () => {
|
||||
document.body.insertAdjacentHTML('beforeend', `
|
||||
<div class="img-modal">
|
||||
<div>
|
||||
<a href="#" class="close">×</a>
|
||||
<img src="${img.src}" alt="">
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
document.querySelector('.img-modal div').style.height = (document.querySelector('.img-modal img').height+80) + 'px';
|
||||
document.querySelector('.img-modal .close').onclick = event => {
|
||||
event.preventDefault();
|
||||
document.querySelector('.img-modal').remove();
|
||||
};
|
||||
document.querySelector('.img-modal').onclick = event => {
|
||||
if (event.target.classList.contains('img-modal')) document.querySelector('.img-modal').remove();
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
if (document.querySelector('.product #product-form')) {
|
||||
|
||||
Reference in New Issue
Block a user