How to use the <sn-time-timer> tag in a widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 02:19 AM - edited 10-25-2023 03:28 AM
Can anyone tell me how to use the <sn-time-timer> tag in a widget?
Thanks in advanced!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 04:12 AM
Hi @Unique45
In your widget's HTML, you can include the <sn-time-timer> element to render the timer.
for eg -
<sn-time-timer
duration="300"
on-complete="myFunction()">
</sn-time-timer>
If you use the on-complete attribute, you can define a JavaScript function in your widget's client-side code that will be called when the timer reaches zero.
For eg-
function myFunction() {
// This function is called when the timer reaches zero.
alert('Timer completed!');
}
You can also apply CSS styles to the <sn-time-timer> element to control its appearance.
This can be done through your widget's CSS or by referencing external styles.
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar