I need some help. I am putting a jquery countdown timer on a page. the countdown I am using is http://keith-wood.name/countdown.html what I need is when one countdown expires, it will then count down to another date. So for example it will countdown to 1/08/2015. When it reaches 1/08/2015 I then want it to count down to another date. So from 1/08/2015 it will then count down to 5/08/2015. I hope that makes sense. I have successfully put the countdown itself on the page. it is just the On expiry I am having trouble with.
This is the script from the example.
<script>
$(function () {
var austDay = new Date();
austDay = new Date(2015, 11 - 1, 7);
$('#defaultCountdown').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
});
</script>
It is displayed in this tag
<center><div id="defaultCountdown"></div></center>
I have made an effort towards it. This is as far as I have got but it is also as far as I can go. Any help would be greatly appreciated
$(function () {
var austDay = new Date();
FirstDay = new Date(2015, 11 - 1, 7);
SecondDay = new Date (2015, 11 - 1, 9);
$('#defaultCountdown').countdown({until: FirstDay});
});
Should of mentioned that there are going to be 4 dates to countdown to in total!
What about comparing the date with the current date?
I don't want to enforce my logic here, the concept would be comparing the date with the current one. However, this approach won't work perfectly unless the client machine is set to the right time and have the same time zone, or it will have different output to each client. I prefer to do the comparison on the server side. Edit I changed it so that the second counter starts just after the first one
You have
onExpiry
event which you can utilize and below is just a sample how you could do! Not sure if it works or not!! May be you have to trial and error.set a global variable first to check once count has been done:
You can find the options here
UPDATE
Ok just copy and paste this below code as it is!!
Its tested
DEMO HERE