Skip to content

Comments

Update jquery.ccountdown.js#1

Open
d33v wants to merge 1 commit intonikhiln:masterfrom
d33v:patch-1
Open

Update jquery.ccountdown.js#1
d33v wants to merge 1 commit intonikhiln:masterfrom
d33v:patch-1

Conversation

@d33v
Copy link

@d33v d33v commented Aug 1, 2013

Because this is a count down, the circles must be decreased and go backward to zero so it must be ([max]-[the current value]) so it should be
_dday=Math.floor(365-(_dd/(60_60_1000_24)_1));
_dhour=Math.floor(24-((_dd%(60_60_1000_24))/(60_60_1000)_1));
_dmin=Math.floor(60-(((_dd%(60_60_1000_24))%(60_60_1000))/(60_1000)_1));
_dsec=Math.floor(60-((((_dd%(60_60_1000_24))%(60_60_1000))%(60_1000))/1000_1));

        or get the max from $('.days').attr('data-max'); and ...

Because this is a count down the circles must be decreased and go backward to zero so it must be ([max]-[the current value]
@nikhiln
Copy link
Owner

nikhiln commented Aug 17, 2013

I am not getting it..could you please show me your demo page after changes ?

@d33v
Copy link
Author

d33v commented Aug 17, 2013

I mean after counting down the circle is completing. I think the circle should move CCW and not CW, your circle is increasing by time, for example your text is showing 50 > 49 > 48 > ... > 0 (decreasing) but your circle is completing like this 0> 1> 2 > ... > 50 (increasing). If this is not clear enough, I will upload a demo.

@MTTHWBSH
Copy link

The updated math isn't working for me, but I'm interested in replicating this idea (a countdown rather than a countup), is this working on your end @d33v?

@d33v
Copy link
Author

d33v commented Oct 30, 2013

yes, I make a under construction theme with it but I had to make some changes to it, i had to add another element to show the values, I was in a hurry so sorry if its messy! :)
I added
div with class="secondtext"
div with class="minutetext"
div with class="hourtext"
div with class="daytext"
to index.html file
then changed part of jquery.ccountdown,js to
/* calculation of remaining days, hrs, min, and secs _/
_dd=Date.parse(_futurestring)-Date.parse(_todaystring);
_dday=Math.floor(365-(_dd/(60_60_1000_24)_1));
_dhour=Math.floor(24-((_dd%(60_60_1000_24))/(60_60_1000)_1));
_dmin=Math.floor(60-(((_dd%(60_60_1000_24))%(60_60_1000))/(60_1000)_1));
_dsec=Math.floor(60-((((_dd%(60_60_1000_24))%(60_60_1000))%(60_1000))/1000*1));
var $ss = $(".second"), $mm = $(".minute"),$hh = $(".hour"),$dd = $(".days");
$ss.val(_dsec);
//here is what is making the math! another digit container!
$('.secondtext').html((60-(_dsec))+' second(s)');
$('.minutetext').html((60-(_dmin))+' minute(s)');
$('.hourtext').html((24-(_dhour))+' hour(s)');
$('.daytext').html((360-(_dday))+' day(s)');
...
I had to make it work fast so I didn't think for the best solution,
canvas and number values are relate to each other but they go opposite directions!
if you change one it will change the other one!
I hope this will help you!

@danimalnelson
Copy link

Or you could just change the angleArc variable to -360 instead of 360.

@MTTHWBSH
Copy link

^ +1

@nikhiln
Copy link
Owner

nikhiln commented Nov 1, 2013

@d33v could you please share a link to underconstruction theme if possible ? I'll check it and will merge your pull request.
I know multiple countdown isn't working..probably I'll spend some time in this holiday to make it work. Thx.

@d33v
Copy link
Author

d33v commented Nov 1, 2013

link to under construction ( messy version ;) ): http://thedeev.net/coming-soon/

@nikhiln
Copy link
Owner

nikhiln commented Nov 1, 2013

@d33v cool....I think we should give option to set direction (clockwise or anticlockwise) to user ? any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants