+ 6

[SOLVED]Please help me with this Code

I want to add transition to the progress bar as soon as it's value is changed but I can't do it.Please help me with it. https://code.sololearn.com/WQK9KMBf7ZYW/?ref=app The problem has been solved as follows https://code.sololearn.com/W4ADB7x4CJ1K/?ref=app

7th May 2017, 2:31 AM
Siddharth Saraf
9 Answers
+ 9
Siddharth i can animate the progress in the following code but not according to the value of the input box...Maybe you can do that:- https://code.sololearn.com/WuYD9ky3113D/?ref=app
7th May 2017, 3:52 AM
Nikhil
Nikhil - avatar
+ 7
Hmmm??? Value Work with transition??? My stupid brain say "no way" If you want transition to it you should make your own progress bar instead (mean need child parent and node) (Easy way...)
7th May 2017, 2:49 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 7
@Siddharth Replace your update function with below one. This is a hack for animation. function update() { var interval = setInterval(function(){ progress.value++; if(progress.value == input.value){ clearInterval(interval); } }, 10); }
7th May 2017, 4:11 AM
Ashwani Kumar
Ashwani Kumar - avatar
+ 7
@Ashwani your method works great....But once it reaches a point (example : take value as 55) we cant get it back by adding a smaller value less than the former one
7th May 2017, 4:15 AM
Nikhil
Nikhil - avatar
+ 6
@Nikhil this is not a full proof solution. This is just an idea. Which can be further be modified to decrement progress bar value also. e.g If input.value is less than initial progress.value then progress.value--
7th May 2017, 4:18 AM
Ashwani Kumar
Ashwani Kumar - avatar
+ 6
Thank you @Ashwani sir Please check this one https://code.sololearn.com/W4ADB7x4CJ1K/?ref=app
7th May 2017, 5:23 AM
Siddharth Saraf
+ 6
You can use 'oninput' event instead of both 'onchange' and 'onkeyup': <input id="value" oninput="update()" max="100" min="0"> ;) [ edit ] ... and lose the habit of using slash ( / ) at end of self-closing tag ^^
7th May 2017, 5:25 AM
visph
visph - avatar
+ 6
@Siddharth Saraf 👍😄 Ah...Setinterval instead of transition!
7th May 2017, 6:18 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 2
@Siddharth, https://codepen.io/mcraiganthony/pen/waaeWO Take a look at this code, there is animation on progress bar, but not on value change.
7th May 2017, 4:30 AM
CalviŐ˛
CalviŐ˛ - avatar