jquery countdown pause and resume feature?
i need to code to pause and resume jquery countdown . for this script: http://p开发者_StackOverflow中文版lugins.jquery.com/project/jquery-countdown
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');
}
);
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.
精彩评论