Question

i need to code to pause and resume jquery countdown . for this script: http://plugins.jquery.com/project/jquery-countdown

Was it helpful?

Solution

Use the plugin's stop function, like this:

<span id="count">8</span>
<input type="button" id="pause" value="Pause" />
<input type="button" id="resume" value="Resume" />

And the js:

function start() {
    $('#count').countdown({seconds: parseInt($('#count').text())});
}
function pause() {
    $('#count').countdown.stop();
}
$('#pause').click(pause);
$('#resume').click(start);
start();

Look at it working here.

OTHER TIPS

With this plugin is very simple

http://keith-wood.name/countdown.html

$('#pauseButton').toggle(
    function() { 
        $(this).text('Resume'); 
        $('#pauseResume').countdown('pause'); 
    }, 
    function() { 
        $(this).text('Pause'); 
        $('#pauseResume').countdown('resume'); 
    } 
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top