Skywalker71's picture
сделай несколько страниц и современым
fb34bbe verified
Raw History Blame Contribute Delete
1.54 kB
// Main JavaScript functionality
document.addEventListener('DOMContentLoaded', () => {
// Initialize any global functionality here
console.log('ByteBazaar loaded!');
// Initialize price range slider
const initRangeSliders = () => {
document.querySelectorAll('input[type="range"]').forEach(slider => {
slider.addEventListener('input', function() {
const valueDisplay = this.nextElementSibling?.querySelector('span:nth-child(2)');
if (valueDisplay) {
valueDisplay.textContent = `${this.value}`;
}
});
});
};
// Initialize filter sections
const initFilterSections = () => {
document.querySelectorAll('.filter-section').forEach(section => {
const header = section.querySelector('.filter-header');
if (header) {
header.addEventListener('click', () => {
const content = section.querySelector('.filter-content');
content.classList.toggle('hidden');
});
}
});
};
initRangeSliders();
initFilterSections();
// Example: Add to cart functionality
document.addEventListener('click', (e) => {
if (e.target.classList.contains('add-to-cart')) {
const product = e.target.closest('.product-card').dataset.product;
alert(`Added ${product} to your cart!`);
}
});
// Mobile menu toggle would be handled by the navbar component
});