top of page

Wix Studio Tips and Tricks

Public·1 member

Dynamic Count-Up Number - Code


<style>
        @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
        
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            font-family: 'Roboto', sans-serif;
            background-color: #ffffff;
        }
        #count {
            font-size: 32px;
            font-weight: bold;
        }
    </style>
<body>
    <div id="count">0</div>

    <script>
        let count = 0;
        const target = 10000;
        const speed = 10; // Adjust this value for speed control

        function updateCount() {
            const increment = target / 100; // Adjust to control increment speed

            if (count < target) {
                count += increment;
                document.getElementById('count').textContent = Math.ceil(count).toLocaleString() + '+';
                setTimeout(updateCount, speed);
            } else {
                document.getElementById('count').textContent = target.toLocaleString() + '+';
            }
        }

        updateCount();
    </script>
</body>

231 Views

About

Share your cool Wix Studio Tips and Tricks

bottom of page