Countdown Timer Widget Demo

Lightweight, customizable countdown timer for sales, events, and deadlines. No dependencies, mobile responsive, accessible.

Demo 1: Default Countdown (New Year 2027)

Standard countdown with days, hours, minutes, and seconds.

<div data-tradecalcs-countdown
     data-target="2027-01-01T00:00:00"
     data-labels="Days,Hours,Minutes,Seconds"
     data-complete="Happy New Year 2027!">
</div>

Demo 2: Sale Countdown (24 Hours)

Countdown for a limited-time sale or promotion.

<div data-tradecalcs-countdown
     data-target="2026-05-21T10:17:00"
     data-labels="Days,Hours,Mins,Secs"
     data-complete="Sale Ended!">
</div>

Demo 3: Compact Style

Smaller countdown for sidebars or tight spaces.

<div data-tradecalcs-countdown
     data-compact="true"
     data-target="2026-06-01T00:00:00"
     data-labels="D,H,M,S">
</div>

Demo 4: Custom Theme (Purple)

Customized colors using CSS variables.

<div data-tradecalcs-countdown
     data-target="2026-07-04T00:00:00"
     style="--tc-countdown-bg: #faf5ff;
            --tc-countdown-border: #9333ea;
            --tc-countdown-value-color: #7e22ce;">
</div>

📦 Installation

Step 1: Add the CSS and JavaScript files to your HTML:

<!-- Add to <head> -->
<link rel="stylesheet" href="/widgets/countdown-timer.css">

<!-- Add before closing </body> -->
<script src="/widgets/countdown-timer.js"></script>

Step 2: Add a countdown to your page:

<div data-tradecalcs-countdown
     data-target="2027-01-01T00:00:00"
     data-labels="Days,Hours,Minutes,Seconds"
     data-complete="Time's up!">
</div>

Note: Replace d790a6cc.tradecalcs.pages.dev with tradecalcs.com once the production domain is configured.

Configuration Options

Data Attributes

CSS Custom Properties

JavaScript API

// Initialize all countdowns manually
TradeCalcsCountdown.init();

// Initialize specific countdown
const element = document.querySelector('[data-tradecalcs-countdown]');
TradeCalcsCountdown.initElement(element);

// Stop a countdown
TradeCalcsCountdown.stop(element);
TradeCalcsCountdown.stop('countdown-id');

// Listen for completion
element.addEventListener('tc-countdown-complete', function(e) {
  console.log('Countdown completed!', e.detail);
});

Features

Use Cases

Browser Support

Works in all modern browsers:

Our Network

Cali Dream Construction RemodelSD Escondido Home Remodeling

Built by Cali Dream Construction · CSLB #1054602

Get a Custom Quote — Contact TradeCalcs