开发者

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');
    });
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜