Giter Site home page Giter Site logo

timecircles's Introduction

Unfortunately I am limited in what I can do with these pages. For better formatted documentation, see: http://git.wimbarelds.nl/TimeCircles/readme.php

TimeCircles documentation

TimeCircles is a jQuery plugin that provides a nice looking way to either count down towards a certain time, or to count up from a certain time. The goal for TimeCircles is to provide a simple yet dynamic tool that makes it very easy to provide visitors an attractive countdown or timer.

This documentation will provide some examples of how to use TimeCircles. Usage of TimeCircles can be very simple, but for those willing to work a little harder can also provide more sophisticated functionality. The examples aim to provide a good basic idea of how various features can be used without overcomplicating things.

General use

The first thing to do is to include the JavaScript files for jQuery and TimeCircles, as well as the TimeCircles stylesheet. These should ideally be included in the head of your html file.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="TimeCircles.js"></script>
<link href="TimeCircles.css" rel="stylesheet">

When the necessary files have been included, it's very simple to set up TimeCircles on your page, simply target the element you wish to use with jQuery, and execute the TimeCircles function on it. This will create TimeCircles inside the targeted element, counting up from 0 (when the page was opened).

Important note: TimeCircles will automatically make its self the size of whatever element you place it in. If you do not have a height set, it will attempt to determine a height based on the element's width. For the best results however, it's recommended to set both the width and height.

Setting your reference time

Of course, you might not want to start counting up from 0. Perhaps you're counting down the time until a wedding, or alternatively counting how long you've been with your girlfriend (or whatever else really). Really, TimeCircles is most useful if you're using it with some reference time and/or date.

Setting up your reference date and time is also fairly simple. The best way to do it is to simply include it in the html element you've set aside for TimeCircles. Create an attribute called data-date and provide a value in the format of yyyy-mm-dd hh:mm:ss

<div class="example" data-date="2014-01-01 00:00:00"></div>

Creating a stopwatch

It is also possible that you want to use TimeCircles to count down a specific amount of time, like 15 minutes. This works similarly as creating a reference time, however here the attribute data-timer is used, and the value is the time to count down from (in seconds).

<div class="example" data-timer="900"></div>

Options

It's nice that TimeCircles comes in yellow, green, blue, and red- but wouldn't it be even nicer if it came in the color theme of your own website? Alternatively, wouldn't it be great if you could change other aspects of the way it looks? Perhaps change the language of the text to whatever you want?

To customize TimeCircles to fit precisely what you're looking for you can use the options. In this section we will look into what options are available and what each option means.

start (default: true)

This option determines whether or not TimeCircles should start immediately. If for example you wish to create a stopwatch that starts when the user clicks a button, you'll want to set this to false.

$(".example").TimeCircles({start: false}); 

animation (default: "smooth")

The way the circles animate can be either a constant gradual rotating, slowly moving from one second to the other. Or it can be set to jump from one unit to the next, only changing the circle when the number within it also changes. The first type is called "smooth", the second type is called "ticks".

$(".example").TimeCircles({animation_interval: "smooth"});

count_past_zero (default: true)

This option is only really useful for when counting down. What it does is either give you the option to stop the timer, or start counting up after you've hit the predefined date (or your stopwatch hits zero).

$(".example").TimeCircles({count_past_zero: false}); 

circle_bg_color (default: "#60686F")

This option determines the color of the background circle.

$(".example").TimeCircles({circle_bg_color: "#000000"}); 

use_background (default: true)

This options sets whether any background circle should be drawn at all. Disabling this option could be used in isolation, or you could use a background of your own to place behind TimeCircles.

$(".example").TimeCircles({use_background: false}); 

fg_width (default: 0.1)

This option sets the width of the foreground circle. The width is set relative to the size of the circle as a whole. A value of 0.1 means 10%, so if your TimeCircles are 100 pixels high, the foreground circle will be 10 percent of that (10 pixels).

$(".example").TimeCircles({fg_width: 0.05});

bg_width (default: 1.2)

This option sets the width of the background circle. The width of the background circle is set relative to the width of the foreground circle. A value of 1 means 100%, so a value of 1 would mean having a width equal to your foreground ring. Higher and you get wider, lower you get thinner.

$(".example").TimeCircles({bg_width: 0.5}); 

text_size (default: 0.07)

This option sets the font size of the text (Days/Hours/Minutes/etc.) in the circles. The size is set relative to the size of the circle as a whole. A value of 1 means 100%, so a value of 1 would mean having a width equal to your foreground ring.

$(".example").TimeCircles({text_size: 0.1});

number_size (default: 0.28)

This option sets the font size of the numbers in the circles. The size is set relative to the size of the circle as a whole. A value of 1 means 100%, so a value of 1 would mean having a width equal to your foreground ring.

$(".example").TimeCircles({number_size: 0.25});

total_duration (default: "Auto")

This option can be set to change how much time will fill the largest visible circle. Normally this is the Days circle, but this can be any of the other circles depending on visible settings. Valid for this variable are "Auto", "Years", "Months", "Days", "Hours", "Minutes" or any numeric value (ie: 30 for thirty seconds).

$(".example").TimeCircles({total_duration: "Auto"});

direction (default: "Clockwise")

This option can be set to change the direction in which the circles fill up. Valid values for this are "Clockwise", "Counter-clockwise" or "Both".

$(".example").TimeCircles({direction: "Clockwise"});

start_angle (default: 0)

This option can be set to change the starting point from which the circles will fill up. This should be an integer value between 0 and 360. 0 is from the top, 90 from the right, 180 from the bottom and 270 from the left.

$(".example").TimeCircles({start_angle: 0});

time

The time option is actually a group of options that allows you to control the options of each time unit independently. As such, within time each unit of time has its own sub-category. These categories are: Days, Hours, Minutes, and Seconds. The options available within each category are as follows:

  • show: Determines whether the time unit should be shown at all
  • text: Determines the text shown below the time. Useful for use on non-English websites
  • color: Determines the color of the foreground circle of the time unit
    $(".example").TimeCircles({ time: {
        Days: { color: "#C0C8CF" },
        Hours: { color: "#C0C8CF" },
        Minutes: { color: "#C0C8CF" },
        Seconds: { color: "#C0C8CF" }
    }});

Functions

Functions will allow you to interact with your TimeCircles as they're running. Generally speaking, this functionality is most often used by other developers who want their own JavaScript to interact with TimeCircles. However, if you're not a developer yourself, there are still a few functions that are quite simple to use and shouldn't be too hard to tackle.

Before we go into what each function does however, it should be pointed out how these functions can be used. Unlike quite a lot of other jQuery plugins, TimeCircles does not return a jQuery object after instantiating. Instead, it returns a TimeCircles object. This means that function chaining will work slightly differently than it does for other jQuery plugins. To find out more about how to chain other jQuery plugins and functions, have a look at the end() function.

TimeCircles functions themselves (with the exception of the end() function) will return the TimeCircles object. This allows you to chain several functions into each other. IE: You could chain start() straight into addEventListener(callback).

start() , stop() and restart()

These are the most basic functions provided. They allow you to temporarily stop TimeCircles or restart it. Start will unpause the timer when it's stopped, restart will restart it from its original value. If you're using TimeCircles to count down to a certain point in the future, upon unpausing the countdown will jump ahead.

HTML

<div class="example stopwatch" data-timer="900"></div>
<button class="btn btn-success start">Start</button>
<button class="btn btn-danger stop">Stop</button>
<button class="btn btn-info restart">Restart</button>

JavaScript

$(".example.stopwatch").TimeCircles();
$(".start").click(function(){ $(".example.stopwatch").TimeCircles().start(); });
$(".stop").click(function(){ $(".example.stopwatch").TimeCircles().stop(); });
$(".restart").click(function(){ $(".example.stopwatch").TimeCircles().restart(); });

destroy()

If for some reason, you need to get rid of your TimeCircles, or you want to allow users to remove them at the click of a button; you can do that with destroy.

$(".example").TimeCircles().destroy();

rebuild()

Some options or variables are only initialized once, at the time of creating TimeCircles (For example, the width and height, or which circles are being shown). If you change these settings later on, you can have everything reinitialized anew by using .rebuild()

$(".example").TimeCircles().rebuild();

getTime()

Retrieves the number of seconds left (or since) the zero point. Values until zero are positive, values after zero are negative.

$(".example").TimeCircles().getTime();

addListener (callback, type = "visible")

The most powerful interactions with TimeCircles can be achieved using listeners. Using listeners, you can make a ticking sound play every second, or you can make a sound whenever a minute passes. You could even use it to trigger some alarm or whole other JavaScript when the timer hits zero.

The type parameter allows you to listen to either only the events from the visible TimeCircles, or all TimeCircles. Correct values are "visible" or "all". The default value is "visible", but through using "all" you can listen to the circles you're hiding (if you're hiding any of course).

To add a listener, use the addListener(callback, type) function. Callback is a function you pass to the event listener. The callback will then be triggered for each event. Three parameters are passed to your callback function, namely:

  • unit: The time unit in string format. So, "Days"/"Hours"/"Minutes"/"Seconds".
  • value: The new value of the time unit that changed. I.e.: 15.
  • total: This is the total time left (or elapsed) since the zero point.
$(".example").TimeCircles({count_past_zero: false}).addListener(countdownComplete);
	
function countdownComplete(unit, value, total){
	if(total<=0){
		$(this).fadeOut('slow').replaceWith("<h2>Time's Up!</h2>");
	}
}

end()

To allow you to chain TimeCircles to other jQuery functions, you can use the end() function. The end function returns the jQuery object and allows you to trigger jQuery functions as desired.

$(".example").TimeCircles().end().fadeOut(); 

timecircles's People

Contributors

herve-brun avatar jmsalazar84 avatar joshhartman avatar maruilian11 avatar pwlmaciejewski avatar vaneves avatar wimbarelds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

timecircles's Issues

Pressing Stop/Start

When you press on stop after the timer has been running, and then press start again it display the total time the timer has been running. It does not start where you originally pressed stop. The time in the background continue to count.

Animation direction

Hi

Currently the animation always travels in an ant-clockwise direction.

Would it be possible to change the direction via a setting so that it travels in either anti/clockwise direction?

Cheers

IE8 compatibility

Hi, tested in IE8 and blow, all is not working, even the countdown numbers and words inside the circles. Is there a method to solve this?

THanks.

Count up invalid result in HOURS section

My current datetime is 2014-01-12 04:33:39. My date time to start counting up from is 2014-01-12 04:16:39 which is less about 0days 0 hours 17mins 2secs but the result output is 0 days 12 hours 17mins 2 secs. Something is definitely wrong with the hours section. It should be 0 hours. please check this out. It should be a little fix. I implemented the last COMMIT you made which fixed my last issue. But this came up

Theming - Custom fonts and animation pattern

Hi.

Is it possible to use custom fonts for the number display, could this work just by setting a font in the CSS?

Could the animated circle be anything other than a solid bar, segments, or mini circles or some other shape/pattern?

Cheers

set total_duration programatically

Hi,

Is there a way to set the total_duration programatically? Even better would be the option to allow it to be the same as the data-timer value.

I am building a single page app which has multiple countdown timers, each one having a different value, this feature would be extremely useful.

Cheers for your continued support and great work.

[Question] How can I trigger an event when the Timer reaches 0?

Hi there,

Hope you can help me out with that: I am using the TimeCircles as a Countdown.

Now, when on the website and the counter reaches 00:00:00 - it starts counting up again (I think I am not using the newest version, will fix that later). Anyway - despite that behaviour, I want to trigger a jQuery event, namely Page Reload, when the counter reaches 0.

I tried working with the .end() event, but that seems not to work (or I implemented it wrongly):

$("#Countdown").TimeCircles().end(function(){
    window.location.reload(true)
});

From the documentation it refers to working with addEventListener() - but honestly I am not familiar with that.

So asking you here: can you help me out with this and pointing me into the right direction for how to achieve a page reload via jQuery as soon as my TimeCircles() reaches 00:00:00? Thank you very much :)

One Circle for the complete Time

Hi,

im trying to have only one circle for the complete time, is that possible ? Let's say i want a countdown for 90 minutes. I don't want to have it separated into 4 circles, but just one.

Is that somehow possible ?

Stop/Start time.

Hi.
Whan i try to make a stopwatch that countdown and press "Stop" the clock stops, but when i then click "Start" then it reset the time, thats wrong.

And can see that the demo inhere is doing the same, how do i fix this so i can stop the time and start it again, without the time is restart ?

Counting down instead of counting up

I executed the following code but instead of counting up, it is counting down. The current system datetime 2014-01-09 11:45:49. i'm trying to count up from 2014-01-09 09:51:49

        setTimeout(function () {
            $('.deadline_tick').each(function () {
                $(this).show(1000, function () {
                    $(this).TimeCircles();
                });
            });
        }, 500);

Its counting down to 2hrs. After changing time to 00:00:00. it works and counts up. Why? I expected differently.

start and stop have unexpected behaviors

When the page loads and it sits idle for any length of time, when pressing "start" the timer already has the amount of time it was sitting there. For example, if load the page, wait 30 seconds before clicking the "start" button the timer will have 30 seconds shown.

If I click "stop". The timer does stop, but clicking "start" causes it the timer to act as though I hadn't stopped it. For example, if the timer says 30 seconds, I click "stop", wait 30 seconds, click "start", timer now reads 1 minute.

<div class="container">
    <div id="PageOpenTimer" style="width: 500px; height: 125px; float: left"></div>
    <button class="btn btn-success start">Start</button> <button class="btn btn-success stop">Stop</button>
</div>
<script>
    $("#PageOpenTimer").TimeCircles({start: false});
    $(".stop").click(function(){
        $("#PageOpenTimer").TimeCircles().stop();
    });
    $(".start").click(function(){ 
        $("#PageOpenTimer").TimeCircles().start();
    }); 
</script>

callbacking looks that doesn't work

Hi, it looks as nice plugin but it looks that doesn't work "callbacking" it means: I need to call myFunction which reinitialize count down timer after count down timer ends. So I have:

jQuery(".example").end().myFunction();

var myFunction = function() {
alert("timer elapsed"); //this don't show
//reinitialization..
}

Do you know how to solve that use case?

remove "days" display

Hi there, here I come back again (shamed).
I was trying to remove the 1(days) of the 4 time circles, so in the end will be only hours, minutes, seconds. I did successfully remove the display of "days" by using

<script type="text/javascript"> $(function() { //circles customizations $("#countdown").TimeCircles({ count_past_zero: false, "bg_width": 1, "fg_width": 0.07777776, "circle_bg_color": "#c0cbcb", "time": { "Hours": { "text": "Hrs", "color": "#e7ebeb" }, "Minutes": { "text": "Min", "color": "#e7ebeb" }, "Seconds": { "text": "Sec", "color": "#e7ebeb" } } }) }); </script>

But more issues come out, my current site wanna it like a countdown timer, so when I have a 2 days countdown, my "time circle" will hide the extra days, how can I add the extra days (which is most time 24 hours ) to hours circles?
I hope I explained myself clear.
Thanks so much for help.

Forward to URL at Zero

Sweet count down/up plugin! Thank you for sharing.

I have read the closed issues, checkouted docs and demo but cannot seem to find way to forward to URL once counter is at zero.

Lets say someone arrives at page and counter is setting at zero. How (or is even possible) can I forward said visitor to a URL of my choice?

Once they arrive on page, say 10 seconds later they are forwarded to http://google.com

Anyway to do this?

Thanks again for the script, appreciated much.

Using addListener() to change the circle colours...

I'm not entirely sure how to access the TimeCircles() properties after it's been instantiated. We instantiate like so:

$('#idle_timer').attr('data-timer',1800);
$('#idle_timer').TimeCircles({ time: {
Days: { show:false },
Hours: { show:false },
Minutes: { color: '#4D8DC1' },
Seconds: { color: '#4D8DC1' } } })
.addListener(function(unit,value,total) { if (total == 1200) { } else if (total == 1500) { alert('Your session will expire in 5 minutes, you should save your work and / or reload the page.'); } } );

In the test for "total == 1200", how could I access the minutes / seconds colour attributes so for instance both could be changed to red? $(this) doesn't seem to be available.

show timer but don't start it

Hi there,

Is there an option to show the countdown timer with the total_duration but not start it? if i use start: false it won't appear until i call .timerCircles().start() . The reason why i'm asking you this is because i want to bring the timer in the page with a slide animation and start it after all other elements appeared (also with different animations). Thanks!

Show option not work

First of all, really nice work 👍 . I'm watching your code and i didn't see where you use the attribute "show" and it isn't work. I wish i could help you with the solution :(

tCircles.TimeCircles({ start: false,
time: {
Days: { show: false, text: "DIAS" ,
color: "#5eebd4"},
Hours: { show: true, text: "HORAS" ,
color: "#34bced"},
Minutes: { show: true, text: "MINUTOS",
color: "#3468ed" },
Seconds: { show: true, text: "SEGUNDOS",
color: "#f66235" }
}});

Animation carries on after 0 seconds is displayed

I've set the counter "total duration" to 5 seconds

When the number displayed reaches 0 the animation still shows the last part of the arc animating toward the zero point.

Should the animation finish animating at the exact same time as the number reaches 0.

Hide Days, Hours, Minutes and Seconds

  1. Does anyone know of any method to hide the Days, Hours, Minutes and Seconds after they hide zero ?

The use case is to replace the timer div with an "event reached"message after the seonds count is Zero.

Thanks.

How to make responsive?

While TimeCircles draws to fill 100% of its container when the page loads, if you resize the page and the container changes dimensions, TimeCircles remains at it's original dimensions and does not redraw itself.

Is there a way to update TimeCircles on screen resize?

I tried

$(window).resize(TimeCircles);

but that didn't do anything. Sorry to inundate you with questions :) Your help is greatly appreciated.

Change data-timer

Hello. Thanks for this great plugin.
I am trying to change the data-timer value with Javascript or by changing the value of an input. So making it a variable. Can you please advice me how to change the value of the data-timer this way?
Thanks!

count past zero causes errors

Hi,

Lovely plugin, but I have 2 problems if you can offer any help.

I've set "count_past_zero" to false but it causes errors:

Line 273:
uncaught reference error: time is not defined

When I set days, hours, and minutes to false, the second counter no longer shows the foreground color.

Im using Win7 and i've tested on Chrome, IE11 and Firefox


$("#CountDownTimer").TimeCircles({
start: true, // determines whether or not TimeCircles should start immediately.
refresh_interval: 0.1, // determines how frequently TimeCircles is updated.
count_past_zero: false, // This option is only really useful for when counting down. What it does is either give you the option to stop the timer, or start counting up after you've hit the predefined date (or your stopwatch hits zero).
circle_bg_color: "#60686F", // determines the color of the background circle.
use_background: true, // sets whether any background circle should be drawn at all.
fg_width: 0.1, // sets the width of the foreground circle.
bg_width: 1.2, // sets the width of the backgroundground circle.
time: { // a group of options that allows you to control the options of each time unit independently.
Days: {
show: false,
text: "Days",
color: "#FC6"
},
Hours: {
show: false,
text: "Hours",
color: "#9CF"
},
Minutes: {
show: false,
text: "Minutes",
color: "#BFB"
},
Seconds: {
show: true,
text: "Seconds",
color: "#BFB"
}
}
});

Show minutes and seconds in the same circle?

Hi,

I've got a project on which I need to display minutes and seconds in XX:XX format, both counting down and counting up, depending on the event type.

Is this possible?

Thanks for your help.

Object doesn't support this property or method

Awesome plugin!

However, while it works fine with Chrome, Firefox, and IE9, it does not work with IE8 and gives an error “Object doesn't support this property or method” and prevents the plugin from running properly.

While I realize GitHub does not support IE8 and below, is there a workaround or fix for this so users with IE8 can benefit from this plugin?

Thanks for your help.

Waldo Buck
www.CoolZips.com

Safari Date.parse problem

Hi,
for solve the problem in Safari NaN in Date.parse, on line 308 add:

if(isNaN(this.data.attributes.ref_date)){
var newDate = attr_data_date.replace(/-/g, '/');
newDate = newDate.replace("T"," ");
this.data.attributes.ref_date = Date.parse(newDate);
}

When hiding a Timer, the next lower Timer doesn't fill out the circle corresponding to it's max value

When I hide a timer, i.e. the "Day" timer like this, the next time instance following (i.e. "Hour") shows the correct time value, but the circle itself is not being filled up correctly (looks like it's stuck at 0 or 1):

<div id="Countdown" data-date="2014-02-11 12:00:00"></div>
<!-- (Remark: "data-date" is always within 24 hour range for the countdown) -->
<script type="text/javascript" src="js/TimeCircles.js"></script>
<script>
    $('#Countdown').TimeCircles({
        start: true,
        refresh_interval: 1,
        time: {
            Days: { show: false },
            Hours: { show: true },
            Minutes: { show: true },
            Seconds: { show: true }
            }
    });
</script>

I fixed it with a dirty workaround inside the "TimeCircles.js" at line 30 for my implementation, by changing the value of "Days:" from Years --> Days:

[...]
    var nextUnits = {
        Seconds: "Minutes",
        Minutes: "Hours",
        Hours: "Days",
        Days: "Days"
    };
[...]

Did I do something wrong in the implementation or is this an official bug?

disable the countdown circles

Hi, I was thinking if I can disable the countdown round circles somehow and only left the countdown number.
Cause I was having responsive issues, was trying to display countdown numbers only when browsing in smaller size screen.

time bug

There is a bug.
If you set a past date, with animation ticks option, it adds a day, an hour, a minute, and a second, more.
anyway great work
thanks
Meg

Refreshed instances of TC called from within iframe to parent result in stacking

The parent page contains an iframe and the timer container div, and the child page called within the iframe is where the timer is actually being instantiated.

On the first page load, the timer appears normally and as expected, however on subsequent refreshes of the iframe page, rather than replacing the existing TC instance on the timer container, the old timer stops and a new timer is stacked under it and begins counting, leaving the old on visible. The expected behaviour would be that the old is removed and the new is displayed.

Apparently the child is not seeing the data attribute TC sets on the parent docs container element that the previous instance set, after the child is refreshed.

Here is some example code to reproduce...

index.html =

<h1>TIMER CIRCLE</h1>
<div id="idle_timer" style="width:300px; height:150px; border:1px solid #666; margin:50px;"></div>
<input id="timer-count" value="15" />
<iframe src="timer.html" style="width:300px; height:150px; border:1px solid #666; margin:50px;"></iframe>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<link type="text/css" rel="stylesheet" href="./TimeCircles.css">
<script type="text/javascript" src="./TimeCircles.js"></script>

timer.html =

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<link type="text/css" rel="stylesheet" href="TimeCircles.css">
<script type="text/javascript" src="TimeCircles.js"></script>
<script>
$( document ).ready(function() {
    var idle_timer = $('div#idle_timer',window.parent.document);
    idle_timer.data('timer',15);
    idle_timer.TimeCircles({ time: { Days: { show:false }, Hours: { show:false }, Minutes: { color: '#4D8DC1' }, Seconds: { color: '#4D8DC1' } } });
</script>

LOADED!

Getting color of bg and fg into stylesheet

Hey great work with the js.

It is working fine and responsive. So...have to read a little bit the docu and then there are no problems to setting up....but one thing :-)

I have set up into my index.html this code for responsive working:

<script type="text/javascript">
    $(window).resize(_.throttle(function(){
    $("#DateCountdown").TimeCircles().rebuild()
        }));    
</script>

Normally i had the settings in this script for colors and so on. But that was not working anymore after I have setup the throttle function. So I have changed the colors in the js here

TC_Instance.prototype.default_options = {
    ref_date: new Date(),
    start: true,
    animation: "ticks",
    count_past_zero: true,
    circle_bg_color: "#f54f36",
    use_background: true,
    fg_width: 0.02,
    bg_width: 0.06,
    total_duration: "Auto",
    direction: "Clockwise",
    start_angle: 0,

    time: {
        Days: {
            show: true,
            text: "Days",
            color: "#f54f36"
        },
        Hours: {
            show: true,
            text: "Hours",
            color: "#f54f36"
        },
        Minutes: {
            show: true,
            text: "Minutes",
            color: "#f54f36"
        },
        Seconds: {
            show: true,
            text: "Seconds",
            color: "#f54f36"
        }
    }
};

Is there a way that I can get the color into a stylesheet to setup color styles?
How to do?
Thanks for your great work. I love it.

Documentation on using addEventListener(callback)

Great plugin and it nearly does what I need, but I don't quite follow how I'm supposed to attached the addEventListener(callback). I don't know what event I'm listening for since i'm waiting on TimeCircles object to finish.

For instance, I have an application where the user will start the timer, but I need to know when the timer is done to post a record or when x amount of time is left to play a sound.

I'm assuming I'd need to use this to "reset" the timer automatically after the time has expired.

Thanks.

Hide Countdown in the middle, but do not end it

Hello,

The help you have provided over has been very helpful for me so far. I have a question regarding showing a single unit of time. I currently have only minutes showing. But when the timer goes below 60, I want the minutes circle to be replaced by the seconds circle. I tried using:

 addListener(function(unit, value, total) {
 if (total < 60) {
 $(this).TimeCircles({ time: { "Minutes": { text: "Hello", "show": false, color: "Red" }, Seconds: { "show": true, color: "Green" } } });

 } else if.........

In this case the minutes do turn red, but they are not hidden, and Seconds do not appear in its place. I do not want to touch the total_duration, only to replace the counter in the middle of the circle once the final 60 seconds are reached. Please let me know if you have any suggestions. Thank you.

Hours, minutes and seconds not displayed on android browser

Hi,

Your script works great, only when using the default android browser only the number of remaining days is visible. The rest are only showing the text and not the reaming time values and circles. Any idea how to fix this? The android version is 4.1.1

'total' seems to be an ABS value rather than going negative in a count-down

When adding a listener that is triggered by the 'total' value, and the timer is set as a count down, the 'total' value doesn't go negative after reaching zero, it seems to just turn around and start counting up.

The effect is that if I set a count down timer for 10 seconds for instance, and then want to trigger something at 5 seconds before the end and a different thing at 5 seconds after reaching 0 (-5 seconds) I cant.

Countdown Circle

I have set the countdown to 15 seconds but when the countdown starts, the color that shows the remaining time starts at about 3 o'clock. I want the color to decrease starting at 12 o'clock until the countdown hits 0. I hope this makes sense.
screen shot 2014-02-23 at 2 40 19 pm

Thanks, Jason

Gradients?

Would it be possible to include a sweep gradient on the remaining time when counting down? I'm trying to illustrate urgency so I'd like the sweep to go from green to yellow to orange to red the closer it gets to the time running out.

Thanks.

No access to time intervals when they're not enabled via 'show:true'

As you may have seen in the other issues I've raised, my goal is to show only minutes until down to the last minute, and then switch to seconds. The problem I'm experiencing though is that it if I want to add an additional trigger at 90 seconds to do something, it's being missed.

It doesn't look like the .addListener method is called for anything that isn't set to show:true, and since at 90 seconds, the seconds circle is still set to show:false my listener is not being triggered.

I added $('input#timer').val(unit + ' ' + value + ' ' + total); within the listener so that I could watch in real time which values were being included with each callback, and they were stuck on Minutes 1 119 (for instance at the 2 min threshhold) for that entire minute, rather than moving back to seconds, allowing me to cath 90.

I believe it would be more logical to ALWAYS return seconds in the callback function, or at the very least allow me to provide a preference within the instantiation call to .TimeCirlces() for a fixed unit.

some concerns

Hi, I just download the awesome plugin from jquery plugin website. it is really a very convenient and powerful tool.
I have one concern so far, consider I had set the countdown time to 150 seconds (it gonna be like 2 minutes and 30 seconds to be countdown). However, every time I refresh the page, the countdown clock go back to where it is originally (start countdown from 2 mins and 30 seconds).
Is there a way to solve this problem, i'm currently working on an events countdown project.
Thanks so much!
Jim

time text field doesnt change on restart?

Love TimeCircles so far...curious on text option within time...

I'm trying to change the text along with the color...color works...but the text doesn't change. Curious on what I might be doing wrong or will it simply not work this way?

Basically my goal is to change add more time once it gets to 0...if I use reload() it works but I lose my $span variable within the addListener if that makes sense.

$target.TimeCircles().addListener(function(unit, value, total) {

    var minutes = Math.floor(total / 60);
    var seconds = total % 60;
    if (seconds < 10) { 
        seconds = "0" + seconds;
    }
    $span.text(minutes + ":" + seconds);
    if (total <= 0) {
        $("#CountDownTimer").data('timer', 60);
        $target.TimeCircles({ time: { Seconds: { color: "#99CCFF", "text": "Switch" } }, "total_duration": 60  });      
        $target.TimeCircles().restart(); 
    }

});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.