Coder Social home page Coder Social logo

CountDown timer about timer.jquery HOT 2 CLOSED

walmik avatar walmik commented on May 30, 2024
CountDown timer

from timer.jquery.

Comments (2)

shacow avatar shacow commented on May 30, 2024

You can use the Timed Events

Start a timer and execute a function after a certain duration. You can use this to simulate a timed event.

//start a timer & execute a function in 5 minutes & 30 seconds
$('#div-id').timer({
duration: '5m30s',
callback: function() {
alert('Time up!');
}
});

from timer.jquery.

walmik avatar walmik commented on May 30, 2024

Thanks @shacow :)

Hi @almasn86 in case you had meant like a reverse timer, then the following will start a timer in a div with id=timer and it will countdown from 5 minutes and go on to 0 seconds:

$('#timer').timer({
    countdown: true,
    duration: '5m'
});

You can change the 5m to 5s to start at 5 seconds instead of 5 minutes. Either ways, once the timer reaches 0 seconds, it will show an alert box by default. You can override this by passing a custom callback to the plugin:

$('#timer').timer({
    countdown: true,
    duration: '5s',
    callback: function() {
        console.log('done');
    }
});

This will output done in the console after counting down 5 seconds. Hope this helps!

from timer.jquery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.