Fake Upload

Here is some fake uploading

by conzett

HTML

<div id="container">
    <div id="progress"></div>
</div>

<button id="begin">Begin</button>
<button id="done">Upload Complete</button>

CSS

#container {
    background : gray;
    padding : 6px;
    width : 300px;
    height : 24px;
    border-radius : 6px;
    margin : 30px;
}

#progress {
    width : 2%;
    height : 100%;
    background : orange;
    border-radius : 3px;
}

JavaScript

var clock, add, count = 0;

add = function() {
    count += 2;
    $('#progress').animate({ width: count +'%' });
    if(count === 100) {
        clearInterval(clock);
    }
}

$('#done').click(function() {
    clearInterval(clock);
    $('#progress').animate({ width: '100%' });
});

$('#begin').click(function() {
  count = 0;
  clock = setInterval(add, 500);
});