Welcome Guest, Not a member yet? Register   Sign In
JQuery help!
#1

[eluser]Aaron L.[/eluser]
Hello,

Might you be able to help with a little simple Javascript? I've been working on this for a couple of hours and have run into a wall:

I need a function that will stop this count-down timer (jQuery plugin) when someone clicks on a link:

Plugin info page:
http://plugins.jquery.com/project/jquery-countdown

Plugin code:
Code:
jQuery.fn.countdown = function(options) {
    /**
     * app init
    */
    if(!options) options = '()';
    if(jQuery(this).length == 0) return false;
    var obj = this;    

    /**
     * break out and execute callback (if any)
     */
    if(options.seconds < 0 || options.seconds == 'undefined')
    {
        if(options.callback) eval(options.callback);
        return null;
    }

    /**
     * recursive countdown
     */
    var countdown = window.setTimeout(
        function() {
            jQuery(obj).html(String(options.seconds));
            --options.seconds;
            jQuery(obj).countdown(options);
        }
        , 1000
    );
    
    /**
     * return null
     */
    return this;

}

Thanks a million if you can help!

Aaron


Messages In This Thread
JQuery help! - by El Forum - 06-16-2008, 06:51 PM
JQuery help! - by El Forum - 06-17-2008, 03:37 PM
JQuery help! - by El Forum - 06-17-2008, 05:49 PM
JQuery help! - by El Forum - 06-17-2008, 06:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB