Загрузка данных


<div id="productModal" class="modal">
    <div class="modal-content">
        <button class="close-button" onclick="closeProduct()">×</button>

        <img id="modalImage" src="" alt="Товар">

        <div class="modal-info">
            <h2 id="modalTitle"></h2>
            <p id="modalDescription"></p>
            <div id="modalPrice" class="modal-price"></div>
        </div>
    </div>
</div>

<script>
const products = [
    {
        title: "Glock 17",
        description: "Современный компактный пистолет.",
        price: "$850",
        image: "URL_КАРТИНКИ_1"
    },
    {
        title: "AK-47",
        description: "Популярная модель винтовки.",
        price: "$1800",
        image: "URL_КАРТИНКИ_2"
    },
    {
        title: "Shotgun",
        description: "Гладкоствольное ружьё.",
        price: "$1200",
        image: "images/shotgun.jpg"
    },

    // Добавь сюда остальные товары
];

function openProduct(number) {
    const product = products[number - 1];

    document.getElementById("modalTitle").textContent = product.title;
    document.getElementById("modalDescription").textContent = product.description;
    document.getElementById("modalPrice").textContent = product.price;
    document.getElementById("modalImage").src = product.image;

    document.getElementById("productModal").classList.add("active");
}

function closeProduct() {
    document.getElementById("productModal").classList.remove("active");
}
</script>

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.modal-content img {
    display: block;
    width: 100%;
    height: 300px;
    object-fit: contain;
    margin-bottom: 20px;
}

.modal-info h2 {
    margin-bottom: 10px;
}

.modal-info p {
    color: var(--muted-color);
    margin-bottom: 15px;
}

.modal-price {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    border: none;
    background: none;
    font-size: 30px;
    cursor: pointer;
}