javascript - JS condition on argument/variable's value? -


i'm trying simple on progress-bar script non-existent knowledges of javascript making me struggle little bit.

what have looks :

if (progress == 100) {     var element = document.getelementbyid("avatar-progress");     element.classlist.add("finish");     settimeout(function () {         $('#avatar-progress').circleprogress(             'value',             0         );     }, 250);                 }  if ($('#avatar-progress').circleprogress('value') == 0) {     var element = document.getelementbyid("avatar-progress");     element.removeattribute("class"); }    $('#avatar-progress').circleprogress({     value: 0,     size: 156,     fill: { color: "#60bcff" },     emptyfill: "#ffffff",     thickness: 2, }); 

basically happens progress-bar :

when uploading hits 100% : class added #avatar-progress cool pulse effect, then, after requiered delay pulse animation, value set 0, making progress-bar disapear, , ready next upload.

however, script's sake, have wait value has returned 0 before deleting class (if don't pulse animation won't load again).

and failed do, don't know how write it, see in code tried stuffs :

if ($('#avatar-progress').circleprogress('value') == 0) {     var element = document.getelementbyid("avatar-progress");     element.removeattribute("class"); } 

but condition doesn't work. i'm looking write line right way. thank suggestions

you can both things inside settimeout function:

if (progress === 100) {   var element = document.getelementbyid('avatar-progress');   element.classlist.add('finish');   settimeout(function () {     $('#avatar-progress').circleprogress('value', 0);     element.classlist.remove('finish');   }, 250); } 

n.b. don't forget use triple equals (===) in javascript, ensure comparison correct.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -