javascript - Jquery Countdown on finish Callback - Stack Overflow

This plugin will show real time countdown which will show on the webpage.I read documentation on.finish

This plugin will show real time countdown which will show on the webpage.

I read documentation on.finish callback on the Official website.

What I try to do is that if the timer finish counting, it will hide span#limit.

This is the link:

.countdown/documentation.html

This is my Code :

HTML :

<span id="limit">
    <input type="hidden" name="limit" value="<?php echo $dataproduct['limit']; ?>" />
</span>

jQuery :

var data = $("input[name=limit]").val();

    $("#limit").countdown(data, function(event) {
    $(this).text(event.strftime('%D days %H:%M:%S'));
       .on('finish.countdown', function() {
           $(this).hide();
       )};
    });

it will show countdown like this on the webpage :

01 days 19:40:00

until

00 days 00:00:00

The problem was this span did not hide just like I try to do.

What's wrong with my code? Callback? Wrong syntax?

This plugin will show real time countdown which will show on the webpage.

I read documentation on.finish callback on the Official website.

What I try to do is that if the timer finish counting, it will hide span#limit.

This is the link:

http://hilios.github.io/jQuery.countdown/documentation.html

This is my Code :

HTML :

<span id="limit">
    <input type="hidden" name="limit" value="<?php echo $dataproduct['limit']; ?>" />
</span>

jQuery :

var data = $("input[name=limit]").val();

    $("#limit").countdown(data, function(event) {
    $(this).text(event.strftime('%D days %H:%M:%S'));
       .on('finish.countdown', function() {
           $(this).hide();
       )};
    });

it will show countdown like this on the webpage :

01 days 19:40:00

until

00 days 00:00:00

The problem was this span did not hide just like I try to do.

What's wrong with my code? Callback? Wrong syntax?

Share Improve this question edited Apr 11, 2016 at 20:27 halfer 20.4k19 gold badges109 silver badges202 bronze badges asked Jul 2, 2015 at 11:00 Ching ChingChing Ching 2171 gold badge5 silver badges15 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

Try this : As per doucument you have provide, you need to call .on('finish.countdown' after closing bracket of .countdown() function. And your code will work as expected.

 var data = $("input[name=limit]").val();

   $("#limit").countdown("2015-07-02 19:40:00", function(event)                        
   {
       $(this).text(event.strftime('%D days %H:%M:%S'));

    }).on('finish.countdown', function() {
           $(this).hide();
    });

JSFiddle Demo

NOTE: Please change the date input as per your convinient so that you can see countdown to bee zero in short time.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745089203a4610586.html

相关推荐

  • javascript - Jquery Countdown on finish Callback - Stack Overflow

    This plugin will show real time countdown which will show on the webpage.I read documentation on.finish

    15小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信