• Resolved ZLC

    (@kindnessville)


    I love your plugin. Could you please let me know how I can show and hide elements on my page when the countdown reaches zero?

    What I’d like to have happen is when the countdown reaches zero, one <div> range disappears and another one appears in its place.

    So instead of registration information being displayed, a message saying that registration has closed is shown instead.

    Is this possible with your plugin?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Nabil Lemsieh

    (@nlemsieh)

    Hello,
    This feature is not currently built in the plugin, but you can make it work by following this workaround:

    1. Select Hide countdown timer as expire action.
    2. Add this javascript code to your website:

      (function($){
      var cdt = $('.hurrytimer-cdt--{ID}');
            if(cdt.length > 0){
                $(cdt).on('finish.countdown', function(){
                    // this will replace the form with your custom message.
                    $('#your-div-id').html('<p>Registration has closed.</p>');
    
                });
    }
    })(jQuery);

    Please, change {ID} with your countdown timer ID (you can find it in it’s shortcode or in your browser address bar). And #your-div-id with your form div id.

    Hope that helps!

    NOTE: This feature will be added to the upcoming releases.

    Let me know if you got any issues using the plugin.

    Thread Starter ZLC

    (@kindnessville)

    Thank you so much for your quick reply, Nabil, and I appreciate your assistance!

    I’m actually trying to achieve a show/hide of two separate div elements, like this:

    HTML:
    <div id=”open”>We’re Open</div>
    <div id=”closed” style=”display:none;”>We’re Closed</div>

    Then the javascript you’d supply would hide the “open” div and show the “closed” div when the countdown finished.

    Do you have code that would achieve this? Thanks again!

    Plugin Author Nabil Lemsieh

    (@nlemsieh)

    In this case, you can use this code instead:

    (function($){
      var cdt = $('.hurrytimer-cdt--{ID}');
            if(cdt.length > 0){
                $(cdt).on('finish.countdown', function(){
                    $('#open').hide();
                    $('#closed').show();
                });
    }
    })(jQuery);

    Don’t forget to change {ID} with your countdown timer ID.

    Thread Starter ZLC

    (@kindnessville)

    Brilliant! Resolved with a HUGE thank you! It works perfectly! I’ll go ahead and be sure to give you the 5-star rating you deserve and a review later this week.

    You really went above and beyond with me on this.

    Thank you again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show/hide at expiry’ is closed to new replies.