odyniec / jQuery-tinyTimer

TinyTimer is a very simple jQuery plugin that lets you create a countdown (or countup) timer on a web page.
34 stars 8 forks source link

Pause/Resume #9

Open n3g opened 10 years ago

n3g commented 10 years ago

Hi, First of all, great plugin! :) I'm trying to use it with a pause/resume button, however I'm getting the same behavior with start() and resume(): they both resume with the time that has elapsed. I'm using jquery 1.10.2 with the latest version of your plugin. The code I have is:

var timer_paused = false;

function pause_resume_timer() {
    var tt = $('#timer').data('tinyTimer'); 

    if (timer_paused) {
        tt.resume();
        timer_paused = false;
    } else {
        tt.stop();
        timer_paused = true;
    }
    $("#pause_resume_icon").toggleClass("icon-pause icon-play");
}
...
<i onclick="pause_resume_timer()" id="pause_resume_icon" class="icon-pause"></i><span id="timer" style="position: absolute; position: relative; left: -68px;"></span>

Any help is appreciated :)

jasondavis commented 9 years ago

Hello did you by chance ever get this working? I am trying to do the same thing myself, could use any help if you can? Thanks