How to count two different values and not stopping the same time
up vote
0
down vote
favorite
I am using jquery.countTo to count two different values but the issue is, the count start at the same time and stop at the same time even though the values are different. How can I start the count at the same time and stop when the value reaches its peak. for example, 216 should stop when it reaches 216 whilst 249 keeps counting until it reaches 249. Thanks
$('#cat-'+catNum+' span#asp-1-ev').countTo({from: 1,to: 249,speed:50000});
$('#cat-'+catNum+' span#asp-2-ev').countTo({from: 1,to: 216,speed:50000});
jquery
add a comment |
up vote
0
down vote
favorite
I am using jquery.countTo to count two different values but the issue is, the count start at the same time and stop at the same time even though the values are different. How can I start the count at the same time and stop when the value reaches its peak. for example, 216 should stop when it reaches 216 whilst 249 keeps counting until it reaches 249. Thanks
$('#cat-'+catNum+' span#asp-1-ev').countTo({from: 1,to: 249,speed:50000});
$('#cat-'+catNum+' span#asp-2-ev').countTo({from: 1,to: 216,speed:50000});
jquery
1
Numeric-indexed IDs are a code smell - consider using classes instead.
– CertainPerformance
Nov 11 at 8:46
Ok got that, but any help about the question asked
– Big Pee
Nov 11 at 8:51
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using jquery.countTo to count two different values but the issue is, the count start at the same time and stop at the same time even though the values are different. How can I start the count at the same time and stop when the value reaches its peak. for example, 216 should stop when it reaches 216 whilst 249 keeps counting until it reaches 249. Thanks
$('#cat-'+catNum+' span#asp-1-ev').countTo({from: 1,to: 249,speed:50000});
$('#cat-'+catNum+' span#asp-2-ev').countTo({from: 1,to: 216,speed:50000});
jquery
I am using jquery.countTo to count two different values but the issue is, the count start at the same time and stop at the same time even though the values are different. How can I start the count at the same time and stop when the value reaches its peak. for example, 216 should stop when it reaches 216 whilst 249 keeps counting until it reaches 249. Thanks
$('#cat-'+catNum+' span#asp-1-ev').countTo({from: 1,to: 249,speed:50000});
$('#cat-'+catNum+' span#asp-2-ev').countTo({from: 1,to: 216,speed:50000});
jquery
jquery
asked Nov 11 at 8:45
Big Pee
54
54
1
Numeric-indexed IDs are a code smell - consider using classes instead.
– CertainPerformance
Nov 11 at 8:46
Ok got that, but any help about the question asked
– Big Pee
Nov 11 at 8:51
add a comment |
1
Numeric-indexed IDs are a code smell - consider using classes instead.
– CertainPerformance
Nov 11 at 8:46
Ok got that, but any help about the question asked
– Big Pee
Nov 11 at 8:51
1
1
Numeric-indexed IDs are a code smell - consider using classes instead.
– CertainPerformance
Nov 11 at 8:46
Numeric-indexed IDs are a code smell - consider using classes instead.
– CertainPerformance
Nov 11 at 8:46
Ok got that, but any help about the question asked
– Big Pee
Nov 11 at 8:51
Ok got that, but any help about the question asked
– Big Pee
Nov 11 at 8:51
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
The speed
option defines how long it should take to reach the finish. Since you put the same value for both counters, they will finish at the same time.
See documentation:
speed | data-speed | The number of milliseconds it should take to finish counting. (default: 1000)
If you want the increments in both widgets to happen with equal intervals, then you could calculate this speed
option dynamically:
const speed = 200;
$('#a').countTo({from: 1, to: 249, speed: 249*speed});
$('#b').countTo({from: 1, to: 216, speed: 216*speed});
Thanks. I tried your solution and it worked perfectly.
– Big Pee
Nov 11 at 9:00
You're welcome ;-)
– trincot
Nov 11 at 9:14
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
The speed
option defines how long it should take to reach the finish. Since you put the same value for both counters, they will finish at the same time.
See documentation:
speed | data-speed | The number of milliseconds it should take to finish counting. (default: 1000)
If you want the increments in both widgets to happen with equal intervals, then you could calculate this speed
option dynamically:
const speed = 200;
$('#a').countTo({from: 1, to: 249, speed: 249*speed});
$('#b').countTo({from: 1, to: 216, speed: 216*speed});
Thanks. I tried your solution and it worked perfectly.
– Big Pee
Nov 11 at 9:00
You're welcome ;-)
– trincot
Nov 11 at 9:14
add a comment |
up vote
0
down vote
accepted
The speed
option defines how long it should take to reach the finish. Since you put the same value for both counters, they will finish at the same time.
See documentation:
speed | data-speed | The number of milliseconds it should take to finish counting. (default: 1000)
If you want the increments in both widgets to happen with equal intervals, then you could calculate this speed
option dynamically:
const speed = 200;
$('#a').countTo({from: 1, to: 249, speed: 249*speed});
$('#b').countTo({from: 1, to: 216, speed: 216*speed});
Thanks. I tried your solution and it worked perfectly.
– Big Pee
Nov 11 at 9:00
You're welcome ;-)
– trincot
Nov 11 at 9:14
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
The speed
option defines how long it should take to reach the finish. Since you put the same value for both counters, they will finish at the same time.
See documentation:
speed | data-speed | The number of milliseconds it should take to finish counting. (default: 1000)
If you want the increments in both widgets to happen with equal intervals, then you could calculate this speed
option dynamically:
const speed = 200;
$('#a').countTo({from: 1, to: 249, speed: 249*speed});
$('#b').countTo({from: 1, to: 216, speed: 216*speed});
The speed
option defines how long it should take to reach the finish. Since you put the same value for both counters, they will finish at the same time.
See documentation:
speed | data-speed | The number of milliseconds it should take to finish counting. (default: 1000)
If you want the increments in both widgets to happen with equal intervals, then you could calculate this speed
option dynamically:
const speed = 200;
$('#a').countTo({from: 1, to: 249, speed: 249*speed});
$('#b').countTo({from: 1, to: 216, speed: 216*speed});
answered Nov 11 at 8:53
trincot
114k1477109
114k1477109
Thanks. I tried your solution and it worked perfectly.
– Big Pee
Nov 11 at 9:00
You're welcome ;-)
– trincot
Nov 11 at 9:14
add a comment |
Thanks. I tried your solution and it worked perfectly.
– Big Pee
Nov 11 at 9:00
You're welcome ;-)
– trincot
Nov 11 at 9:14
Thanks. I tried your solution and it worked perfectly.
– Big Pee
Nov 11 at 9:00
Thanks. I tried your solution and it worked perfectly.
– Big Pee
Nov 11 at 9:00
You're welcome ;-)
– trincot
Nov 11 at 9:14
You're welcome ;-)
– trincot
Nov 11 at 9:14
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247122%2fhow-to-count-two-different-values-and-not-stopping-the-same-time%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Numeric-indexed IDs are a code smell - consider using classes instead.
– CertainPerformance
Nov 11 at 8:46
Ok got that, but any help about the question asked
– Big Pee
Nov 11 at 8:51