Snippets Card Product - View 360 - Bootstrap 5

🏷️ Extraits & Composants HTML 📅 30/03/2026 11:00:00 👤 Mezgani said
Bootstrap 5 Card Card Product Ui Snippets Html

Snippet de carte de produit avec visualisation 360° et design moderne en responsive avec Bootstrap 5.

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8" />
    <meta name="copyright" content="MEZGANI Said" />
    <meta name="author" content="AngularForAll" />
    <meta name="robots" content="noindex, nofollow" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Snippet Product View360 2026 04201405 | AngularForAll</title>
<style>
        body {
            font-family: Arial;
            background: #f0f0f0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
            padding: 20px;
        }
        .viewer {
            background: white;
            border-radius: 20px;
            padding: 30px;
            text-align: center;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        }
        #productImage {
            width: 400px;
            height: auto;
            border-radius: 10px;
            cursor: pointer;
        }
        .controls {
            margin-top: 20px;
        }
        button {
            margin: 5px;
            padding: 10px 20px;
            font-size: 16px;
            background: #2c3e8f;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        button:hover {
            background: #1e2a5e;
        }
        .angle {
            margin-top: 15px;
            font-size: 14px;
            color: #666;
        }
    </style>
</head>
<body>
    <div class="viewer">
        <h2>Samsung Galaxy A26 5G</h2>
        <p>Visualisation 360° - 6 angles</p>

        <img id="productImage" src="public/mobile1.png" alt="Samsung Galaxy A26">

        <div class="controls">
            <button id="prevBtn">◄ Précédent</button>
            <button id="autoBtn">▶ Rotation auto</button>
            <button id="nextBtn">Suivant ►</button>
        </div>

        <div class="angle">
            Angle <span id="angleNum">1</span> / 3
        </div>
    </div>

    <script>
        const images = ["public/mobile2.png", "public/mobile3.png", "public/mobile4.png"];
        let currentIndex = 0;
        let autoInterval = null;

        const imgElement = document.getElementById('productImage');
        const angleSpan = document.getElementById('angleNum');

        function updateImage() {
            imgElement.src = images[currentIndex];
            angleSpan.textContent = currentIndex + 1;
        }

        function nextImage() {
            currentIndex = (currentIndex + 1) % images.length;
            updateImage();
        }

        function prevImage() {
            currentIndex = (currentIndex - 1 + images.length) % images.length;
            updateImage();
        }

        function toggleAutoRotate() {
            if (autoInterval) {
                clearInterval(autoInterval);
                autoInterval = null;
                document.getElementById('autoBtn').innerHTML = '▶ Rotation auto';
                document.getElementById('autoBtn').style.background = '#2c3e8f';
            } else {
                autoInterval = setInterval(nextImage, 500);
                document.getElementById('autoBtn').innerHTML = '⏸ Pause';
                document.getElementById('autoBtn').style.background = '#e74c3c';
            }
        }

        document.getElementById('prevBtn').onclick = () => {
            if (autoInterval) toggleAutoRotate();
            prevImage();
        };
        document.getElementById('nextBtn').onclick = () => {
            if (autoInterval) toggleAutoRotate();
            nextImage();
        };
        document.getElementById('autoBtn').onclick = toggleAutoRotate;

        // Cliquer sur l'image pour passer à la suivante
        imgElement.onclick = () => {
            if (autoInterval) toggleAutoRotate();
            nextImage();
        };
    </script>
</body>
</html>

Ouvrir cet aperçu dans un nouvel onglet du navigateur

🔗 Ouvrir dans le navigateur