libs/nanobar.js
// this will be destroyed after reaching 100% progress
this will be destroyed after reaching 100% progress
this will be destroyed after reaching 100% progress
function createBar(rm) {
	var el = document.createElement("div"),
		width = 0,
		here = 0,
		on = 0,
		bar = {
			el: el,
			go: go,
		};
	addClass(el, "bar");
	function move() {
		var dist = width - here;
		if (dist < 0.1 && dist > -0.1) {
			place(here);
			on = 0;
			if (width >= 100) {
				el.style.display = "none";
				setTimeout(function () {
					rm(el);
				}, 300);
			}
		} else {
			place(width - dist / 4);
			setTimeout(go, 16);
		}
	}
	function place(num) {
		width = num;
		el.style.width = width + "%";
	}
	function go(num) {
		if (num >= 0) {
			here = num;
			if (!on) {
				on = 1;
				move();
			}
		} else if (on) {
			move();
		}
	}
	return bar;
}
function createBar ( rm ) { var el = document . createElement ( "div" ) , width = 0 , here = 0 , on = 0 , bar = { el : el , go : go , } ; addClass ( el , "bar" ) ; function move ( ) { var dist = width - here ; if ( dist < 0.1 && dist > - 0.1 ) { place ( here ) ; on = 0 ; if ( width >= 100 ) { el . style . display = "none" ; setTimeout ( function ( ) { rm ( el ) ; } , 300 ) ; } } else { place ( width - dist / 4 ) ; setTimeout ( go , 16 ) ; } } function place ( num ) { width = num ; el . style . width = width + "%" ; } function go ( num ) { if ( num >= 0 ) { here = num ; if ( ! on ) { on = 1 ; move ( ) ; } } else if ( on ) { move ( ) ; } } return bar ; }
this will be destroyed after reaching 100% progress
this will be destroyed after reaching 100% progress
// create progress element // animation loop // set bar width