Confusing about Jquery Timer
iam using jquery timer http://jquery.offput.ca/timers/ to create document in every 5 second and with pause and resume controlled button. here is my script :
$(function() {
$('.handler').load("../Pages/csFetchCustomer.ashx?");
$('.controlled-interval').everyTime(5000, 'controlled', function() {
$('.handler').load("../Pages/csFetchCustomer.ashx?");
$('.stop').click(function() {
$('.controlled-interval').stopTime('controlled');
});
});
});
with this script, i am already create document that load every 5 second with pause button controll,. but how to create resume / pl开发者_如何学Pythonay button control ? any suggestion are welcome thanks.
There's a working demo on their site that is doing what you want, but here's simplified code of mine:
$(document).ready(function() {
var active = true,
runLoadEvery = function() {
$('.controlled-interval').everyTime(5000, 'controlled', function() {
$('.handler').load("../Pages/csFetchCustomer.ashx?");
});
};
// start running as soon as ready event is fired
runLoadEvery();
$('.start').click(function() {
active = true;
runLoadEvery();
});
$('.stop').click(function() {
active = false;
$('.controlled-interval').stopTime('controlled');
});
});
精彩评论