falc / tock.js Goto Github PK
View Code? Open in Web Editor NEWA nice and accurate Javascript count-up/countdown timer.
License: MIT License
A nice and accurate Javascript count-up/countdown timer.
License: MIT License
Dear Aitor,
looking at how you implemented Tock with var Tock=function(a){...
and trying to adapt it to the project, I face a confusing challenge. You see, I have to load it either within <head></head>
or at the top of <script></script>
in the footer. Actually I'm used to load helpers at the very bottom and reserve top part for actual code. For example, check base58 and z85, they work perfectly fine from any place.
Dear Aitor,
could you be so kind and tell me why the following doesn't work?
countdown1 = new Tock({
countdown: true,
start_time: 10000,
on_tick: function() {
document.querySelector('#timer').innerHTML = countdown1.lap('Clear field in {m}:{ss} <a href="javascript:countdown1.reset();clearField();">now</a>');
},
on_complete: function() {
clearField();
}
});
Countdown continues to run after now
is clicked, however is expected to stop. It works only if <a href="javascript:countdown1.reset();clearField();
is placed somewhere outside, but I would prefer not to create separate span
for control if it's possible.
Update: following doesn't work as well
on_tick: function() {
document.getElementById("job-result-timer").innerHTML =
"Wipe in "+
countdown1.lap("{m}:{ss}")+
" <a href='javascript:countdown1.reset();clearField();'>now</a>";
},
Dear Aitor,
currently Tock seems to output 3 digits for milliseconds, however only the first one is changed noticeably, other two are changed so fast so they look as still (frozen at 0, or 9, or something) and it just creates flickering clutter (in my naive opinion, of course). Could you improve Tock to able to customize look of milliseconds? So {mm}:{ss}.{l}
-> 01:49.5
, like here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.