We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Countdown Timer
Topic Started: Jul 22 2013, 02:27 PM (513 Views)
x DamnLol
Member
[ *  * ]
I've looked alot of places, even tried using some codes to make my own, but to no prevail

is there any code (that i cant seem to find) that has a simple countdown? But, also can countdown by certain hours instead of a predetermined date?

such as, a counter that starts at 7 hours, then counts down; once reaches 0, resets to 7 hours; repeats indefinitely? (maybe gives a 10 second messege after the time hits 0, say i guess 6h 59min 50secs timer w/ 10 second messege span?)

every one i find, whether its a code or just an online widget, all need predetermined dates, so it doesnt work out ;x

Thanks for the help!
Edited by x DamnLol, Jul 23 2013, 03:58 AM.
Offline Profile Goto Top
 
x DamnLol
Member
[ *  * ]
Le Bump
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
There's still some quirks and kinks to sort out, but you can play around with this for now:

HTML:
Code:
 
<div id="countdown" style="margin: 10px"></div>
JavaScript:
Code:
 
<script type="text/javascript">
//<![CDATA[
$(function () {
var hours = 7;
var military = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
var literal = [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
var gh;
var gm;
var gs;

function setInt() {
var nd = new Date();
gh = nd.getHours();
gm = 60 - nd.getMinutes();
gs = 60 - nd.getSeconds();

for (var i = 0; i < military.length; i++) {
if (gh === military[i]) {
gh = literal[i];
}
}

if ($.zb.get('setHours') === '') {
$.zb.set('setHours', gh);
}

gh = (parseInt($.zb.get('setHours'), 10) + hours) - (gh + 1);

if (gh > parseInt($.zb.get('setHours'), 10)) {
$.zb.del('setHours');
}

if (gh < 10) {
gh = '0' + gh;
}

if (gm < 10) {
gm = '0' + gm;
}

if (gs < 10) {
gs = '0' + gs;
}

$('#countdown').html(gh + ':' + gm + ':' + gs);
}

window.setInterval(setInt, 1000);
});
//]]>
</script>
Offline Profile Goto Top
 
x DamnLol
Member
[ *  * ]
ty once again ^.^
Offline Profile Goto Top
 
Moonface
Member Avatar


Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic