D
D
Dmitry Volodarsky2017-03-22 22:28:29
JavaScript
Dmitry Volodarsky, 2017-03-22 22:28:29

How is it done, a timer in the tab title?

I click on start with keyboard control and if you look at the shortcut of the browser tab, then there is a countdown.
https://htdt.github.io/digital_trip/

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Anton, 2017-03-22
@karminski

Update HTML tag every second with JavaScript.

P
Pavel, 2017-03-23
@PavelMonro

Feature from this site...

DT.Game.prototype.updateTimer = function (dtime) {
        var sec, min;
        this.timer += dtime;
        sec = Math.floor(this.timer);
        if (sec > Math.floor(this.timer - dtime) ) {
            min = Math.floor(sec / 60);
            sec = sec % 60;
            sec = sec < 10 ? '0' + sec.toString() : sec;
            DT.$title.html(min + ':' + sec + ' in digital trip');
        }
    };

Everything can be viewed in the console, tab Sources

I
iBird Rose, 2017-03-22
@iiiBird

<title> tag

D
Dmitry Belyaev, 2017-03-23
@bingo347

const BASE_TITLE = 'bla bla';
function onProgress(persent) {
  document.title = `${persent}% ${BASE_TITLE}`;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question