const floatButton = document.createElement('button');
floatButton.classList.add('momyzat-btn');
floatButton.innerText = "أهم ما يميزنا 🌟";
document.body.appendChild(floatButton);
const popupWindow = document.createElement('div');
popupWindow.classList.add('momyzat-popup');
popupWindow.innerHTML = `
`;
document.body.appendChild(popupWindow);
floatButton.addEventListener('click', () => {
popupWindow.classList.toggle('active');
});
const closeButton = popupWindow.querySelector('.close-btn');
closeButton.addEventListener('click', (e) => {
e.preventDefault();
popupWindow.classList.remove('active');
});
// window.onload = function() {
// const style = document.createElement('style');
// style.innerHTML = `
// body {
// position: relative;
// }
// #popup {
// content: "🛒 نحن متجر ELECTRONIA نحن هنا لنوفر لك أفضل المنتجات 🛍️✨";
// position: absolute;
// top: 20px;
// left: 50%;
// transform: translateX(-50%);
// background-color:#4c1c54;
// color:#ffffff;
// padding: 15px 25px;
// border-radius: 12px;
// font-size: 18px;
// font-family: Arial, sans-serif;
// display: none;
// text-align: center;
// max-width: 80%;
// box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
// z-index:99999999999;
// }
// #popup.show {
// display: block;
// animation: fadeInOut 7s ease-in-out forwards;
// }
// @keyframes fadeInOut {
// 0% {
// opacity: 0;
// transform: translateX(-50%) translateY(-20px);
// }
// 20% {
// opacity: 1;
// transform: translateX(-50%) translateY(0);
// }
// 80% {
// opacity: 1;
// transform: translateX(-50%) translateY(0);
// }
// 100% {
// opacity: 0;
// transform: translateX(-50%) translateY(20px);
// }
// }
// `;
// document.head.appendChild(style);
// const popup = document.createElement('div');
// popup.id = 'popup';
// popup.textContent = "🛒 نحن متجر ELECTRONIA نحن هنا لنوفر لك أفضل المنتجات 🛍️✨";
// document.body.appendChild(popup);
// setTimeout(() => {
// popup.classList.add('show');
// setTimeout(() => {
// popup.classList.remove('show');
// }, 7000);
// }, 4000);
// };
const section = document.querySelector('#app > div.app-inner.flex.flex-col.min-h-full > section.s-block.s-block--categories');
const faqData = [
{
question: "هل هناك توصيل لدول الخليج؟",
answer: "نعم نوفر الشحن لكل دول الخليج وبأسعار مغرية"
},
{
question: "هل يمكن ارجاع المنتج في حالة لم يعجبني؟",
answer: "نعم ندعم في متجرنا سياسة الاسترجاع بشرط أن لا تتجاوز المدة 10 أيام من استلام المنتج"
},
{
question: "هل منتجاتكم أصلية؟",
answer: "أكيد نحن نفخر بأن منتجاتنا أصلية وذات جودة عالية"
}
];
if (section) {
section.innerHTML = '';
let questionsHTML = faqData.map(({ question, answer }) => `
`).join('');
section.innerHTML = `
`;
const script = document.createElement('script');
script.textContent = `
document.querySelectorAll('.question-item .question').forEach(question => {
question.addEventListener('click', function () {
const answer = this.nextElementSibling;
const isVisible = answer.classList.contains('show');
document.querySelectorAll('.answer').forEach(a => a.classList.remove('show'));
document.querySelectorAll('.question').forEach(q => q.classList.remove('open'));
if (!isVisible) {
answer.classList.add('show');
this.classList.add('open');
}
});
});
`;
section.appendChild(script);
}
document.addEventListener("DOMContentLoaded", function() {
const elements = document.querySelectorAll('.banner--fixed img');
function handleScroll() {
const windowHeight = window.innerHeight;
elements.forEach(element => {
const rect = element.getBoundingClientRect();
if (rect.top <= windowHeight * 0.8) {
element.classList.add('visible');
}
});
}
window.addEventListener('scroll', handleScroll);
handleScroll();
});
let link = document.createElement("link");
link.href = "https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&display=swap";
link.rel = "stylesheet";
document.head.appendChild(link);
let style = document.createElement("style");
style.innerHTML = `
* {
font-family: 'Cairo', sans-serif !important;
}
`;
document.head.appendChild(style);
document.addEventListener("DOMContentLoaded", function () {
const section = document.querySelector('.s-block.s-block--features');
if (!section) return;
section.innerHTML = `
`;
const style = document.createElement('style');
style.textContent = `
.why-us-grid {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
text-align: center;
}
.feature-card {
background-color: transparent;
border-radius: 20px;
padding: 10px;
text-align: center;
transition: transform 0.4s ease, box-shadow 0.4s ease;
position: relative;
overflow: hidden;
perspective: 1000px;
width: 30%;
min-width: 100px;
}
.feature-card:hover {
transform: translateY(-7px);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}
.icon-wrapper {
width: 80px;
height: 80px;
margin: 0 auto 5px auto;
transition: transform 0.8s ease;
transform-style: preserve-3d;
}
.feature-card:hover .icon-wrapper {
transform: rotateY(180deg);
}
.feature-icon {
width: 100%;
height: 100%;
}
.feature-number {
font-size: 1.4rem;
font-weight: bold;
color: var(--main-color);
margin-bottom: 0px;
}
.feature-label {
font-size: 1rem;
color: var(--main-color);
font-weight: bold;
}
@media (min-width: 768px) {
.why-us-grid {
display: grid !important;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
max-width: 1000px;
margin: auto;
}
.feature-card {
width: 100%;
}
.icon-wrapper {
width: 200px;
height: 200px;
}
.feature-number {
font-size: 2.7rem;
}
.feature-label {
font-size: 1.5rem;
}
}
`;
document.head.appendChild(style);
const startCounting = () => {
const counters = document.querySelectorAll('.feature-number');
counters.forEach(counter => {
const target = +counter.getAttribute('data-target');
let count = 0;
const increment = target / 100;
const updateCount = () => {
if (count < target) {
count += increment;
counter.textContent = Math.ceil(count);
requestAnimationFrame(updateCount);
} else {
counter.textContent = target;
}
};
updateCount();
});
};
const handleScroll = () => {
const section = document.querySelector('.why-us-section');
if (!section) return;
const sectionTop = section.getBoundingClientRect().top;
const triggerPoint = window.innerHeight - 100;
if (sectionTop < triggerPoint) {
startCounting();
window.removeEventListener('scroll', handleScroll);
}
};
window.addEventListener('scroll', handleScroll);
});
document.addEventListener("DOMContentLoaded", function () {
const style = document.createElement('style');
style.textContent = `
@media (max-width: 767px) {
#best-offers-1-slider .swiper-wrapper {
perspective: 1000px;
display: flex;
}
#best-offers-1-slider .s-products-slider-card {
transform-style: preserve-3d;
transition: transform 0.3s ease, box-shadow 0.4s ease;
}
#best-offers-1-slider .swiper-slide-prev,
#best-offers-1-slider .swiper-slide-next {
transform: rotateY(30deg);
opacity: 0.7;
}
#best-offers-1-slider .swiper-slide-active {
transform: rotateY(0deg);
opacity: 1;
}
#best-offers-1-slider .s-products-slider-card:hover {
transform: scale(1.05) rotateY(0deg);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}
}
`;
document.head.appendChild(style);
});
const whatsappButton = document.createElement('div');
whatsappButton.style.position = 'fixed';
whatsappButton.style.bottom = '90px';
whatsappButton.style.left= '20px';
whatsappButton.style.width = '60px';
whatsappButton.style.height = '60px';
whatsappButton.style.backgroundColor = '#25D366';
whatsappButton.style.backgroundImage = 'url("https://upload.wikimedia.org/wikipedia/commons/6/6b/WhatsApp.svg")';
whatsappButton.style.backgroundSize = '70%';
whatsappButton.style.backgroundRepeat = 'no-repeat';
whatsappButton.style.backgroundPosition = 'center';
whatsappButton.style.borderRadius = '50%';
whatsappButton.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.1)';
whatsappButton.style.cursor = 'pointer';
whatsappButton.style.transition = 'transform 0.3s ease';
whatsappButton.style.zIndex = '9';
whatsappButton.onmouseover = function () {
whatsappButton.style.transform = 'scale(1.1)';
};
whatsappButton.onmouseout = function () {
whatsappButton.style.transform = 'scale(1)';
};
whatsappButton.onclick = function () {
window.open('https://almatna.com/whatsapp/send', '_blank');
};
document.body.appendChild(whatsappButton);