Skip to content

"JavaScript CountDown Timer" is a handy web-based tool that enables users to set countdowns for various events. It's built using JavaScript, offering a sleek and intuitive interface for precise time tracking and anticipation of important deadlines.

Notifications You must be signed in to change notification settings

sanjudhritlahre/JS-CountDown-Timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS-CountDown-Timer

"JavaScript CountDown Timer" is a handy web-based tool that enables users to set countdowns for various events. It's built using JavaScript, offering a sleek and intuitive interface for precise time tracking and anticipation of important deadlines.

JavaScript CountDown Timer

A simple and customizable countdown timer implemented in JavaScript.

Features

  • Set a specific countdown time in hours, minutes, and seconds.
  • Display the remaining time in a user-friendly format.
  • Start, pause, and reset the countdown timer.
  • Customizable visual styling using CSS.
  • Trigger a callback function when the countdown reaches zero.

Demo

Check out the live demo of the countdown timer: Live Demo

Getting Started

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/javascript-countdown-timer.git
  2. Include the countdown-timer.js file in your HTML:

    <script src="path/to/countdown-timer.js"></script>
  3. Add the necessary HTML markup to your page:

    <div id="countdown"></div>

Usage

  1. Create a new instance of the CountdownTimer:

    const countdownTimer = new CountdownTimer('countdown', {
      hours: 1,
      minutes: 30,
      seconds: 0,
      onTick: handleTick,
      onComplete: handleComplete
    });
  2. Customize the countdown timer options as needed:

    • hours (optional): Number of hours for the countdown (default: 0).
    • minutes (optional): Number of minutes for the countdown (default: 0).
    • seconds (optional): Number of seconds for the countdown (default: 0).
    • onTick (optional): Callback function called on every tick of the timer.
    • onComplete (optional): Callback function called when the timer reaches zero.
  3. Start the countdown timer:

    countdownTimer.start();

Styling

The countdown timer can be styled using CSS. The main container has the countdown-timer class, and each unit (hours, minutes, seconds) has its own class (countdown-timer__hours, countdown-timer__minutes, countdown-timer__seconds).

.countdown-timer {
  /* Your styles here */
}

.countdown-timer__hours {
  /* Your styles here */
}

.countdown-timer__minutes {
  /* Your styles here */
}

.countdown-timer__seconds {
  /* Your styles here */
}

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

"JavaScript CountDown Timer" is a handy web-based tool that enables users to set countdowns for various events. It's built using JavaScript, offering a sleek and intuitive interface for precise time tracking and anticipation of important deadlines.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published