title: Javascript Countdown Timer redirect after End
body: <p>I have a JavaScript Countdown and I want it to redirect to another site when the countdown ends.</p>
  
  <p>How can I do that?</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>(function ( $ ) {
  
  "use strict";
  
  $.fn.countdownTimer = function( options ) {
  
  
      // This is the easiest way to have default options.
      var settings = $.extend({
          endTime: new Date()
      }, options );
  
      var $this = $(this);
  
      var $seconds = $this.find(".time.seconds");
      var $minutes = $this.find(".time.minutes");
      var $hours = $this.find(".time.hours");
      var $days = $this.find(".time.days");
  
      var seconds = 0;
      var minutes = 0;
      var days = 0;
      var hours = 0;
  
      var switchCountdownValue = function ($obj, val) {
          // Add leading zero
          var s = val+"";
          while (s.length &lt; 2) s = "0" + s;
  
          if(Modernizr.cssanimations) {
              // Fade out previous
              var prev = $obj.find(".value").addClass("fadeOutDown").addClass("animated");
  
              // Add next value
              var next = $("&lt;div class='value'&gt;" + s + "&lt;/div&gt;");
              $obj.prepend(next);
              // Fade in next value
              next.addClass("fadeInDown").addClass("animated");
              // Remove from DOM on animation end
              // Fix for Safari (if window is not active, then webkitAnimationEnd doesn't fire, so delete it on timeout)
              var to = setTimeout(function(){ prev.remove() }, 200);
              prev.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
                  prev.remove();
                  clearTimeout(to);
              });
  
          } else {
              // Remove previous value
              var prev = $obj.find(".value").remove();
              // Add next value
              var next = $("&lt;div class='value'&gt;" + s + "&lt;/div&gt;");
              $obj.prepend(next);
          }
      }
  
      var timerId = countdown(settings.endTime,
          function(ts) {
              if(seconds != ts.seconds) {
                  switchCountdownValue($seconds, ts.seconds);
                  seconds = ts.seconds;
              }
              if(minutes != ts.minutes) {
                  switchCountdownValue($minutes, ts.minutes);
                  minutes = ts.minutes;
              }
              if(hours != ts.hours) {
                  switchCountdownValue($hours, ts.hours);
                  hours = ts.hours;
              }
  
              if(days != ts.days) {
                  switchCountdownValue($days, ts.days);
                  days = ts.days;
              }
          },
          countdown.DAYS|countdown.HOURS|countdown.MINUTES|countdown.SECONDS);
  
  
      return this;
  
  };}( jQuery ));
  </code></pre>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $().ready(function(){
      $(".countdown").countdownTimer({
          endTime: new Date("May 13, 2016 20:00:00")
      });
  
  
      $("#notifyMe").notifyMe();
  
  
      $("#bg-canvas").bezierCanvas({
          maxStyles: 1,
          maxLines: 50,
          lineSpacing: .07,
          spacingVariation: .07,
          colorBase: {r: 120,g: 100,b: 220},
          colorVariation: {r: 50, g: 50, b: 30},
          moveCenterX: 0,
          moveCenterY: 0,
          delayVariation: 3,
          globalAlpha: 0.4,
          globalSpeed:30,
      });
  
  
  
      $().ready(function(){
          $(".overlap .more").click(function(e){
              e.preventDefault();
              $("body,html").animate({scrollTop: $(window).height()});
          });
      });     
  
  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>C&amp;P Code from internet:</p>
  
  <pre><code>http://pastebin.com/CvYNBSED
  </code></pre>
  
  <p>The Countdown is working perfectly, but I want a redirect when the Countdown ends.</p>
  
  <p>Edit:</p>
  
  <p>Thanks for helping but my problem is, how can I make the if question or how can I check when the countdown has finished?</p>
  
  <p>I know how to make a redirect but I dont know how to check if the countdown is finished.</p>