top of page
Crumpled Fabric

1

Add A Simple Count Up Timer To WIX Website

Click URL to copy

Dec 12, 2021

1 min read

WIX Ideas Team

Tags: Digital clock User Interaction Velo by Wix Stop Watch Count up Timer

Hi there🎉, in this tutorial, you will be able to add a count up timer into your WIX website. In this video several functions which were called inside the onClick functions of our button elements were used to automate the stopwatch.



onClick Function Calling Timer Functions
onClick Function Calling Timer Functions

Next, the other sections of the code were the functions themselves which helped us to display the stopwatch or countup timer.


The image below shows the code that shows the function of the start and stop. This is called when a single button is used to pause and/or continue the timer.


Count & Stop Function

The code below shows the function that starts the timer. When this function is placed inside our button's onClick function, the timer should start or continue.



The code below shows the function that pauses the timer. When the function is placed inside our button's onClick function, the timer should be paused.




To add an excellent timer feature in JavaScript, setInterval() method is used according to W3 Schools


The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds).
The setInterval() method will continue calling the function until clearInterval() is called, or the window is closed.
The ID value returned by setInterval() is used as the parameter for the clearInterval() method.
Tip: 1000 ms = 1 second.
Tip: To execute a function only once, after a specified number of milliseconds, use the setTimeout() method.



Code



Leave a comment (0)

Thanks for leaving a comment🎉

RELATED TUTORIALS 🚀

Print Any Page on Wix

Print Any Page on Wix

Allow your site visitors to click on an icon to print any page on your Wix or Wix Studio website

bottom of page