php - Loading bar to next page with bootstrap -
i have 1 question: on website, button "submit" starts loading new page limited time (defined in simple form). that's work perfectly. want when click "start" bar appears , starts loading defined time. use animated loading boostrap:
<div class="progress progress-striped active"> <div class="bar" style="width: 40%;"></div> </div>
how can that? javascript? how? :(
thanks in advance.
total data: data-percentage="60"
total second: data-second="60"
html
<div class="progress progress-striped active"> <div class="bar" style="width: 0%;" data-percentage="60" data-second="20"></div> </div> <a id="clickme">click</a>
js
$('#clickme').click(function () { var me = $('.progress .bar'); var perc = me.attr("data-percentage"); var sec = me.attr("data-second") * 1000; var each = sec / perc; var current_perc = 0; me.css('width', '100%'); me.text('loading..'); settimeout(function () { // after 5 seconds var progress = setinterval(function () { if (current_perc >= perc) { clearinterval(progress); } else { current_perc += 1; me.css('width', (current_perc) + '%'); } me.text((current_perc) + '%'); }, each); }, 2000); });
demo: http://jsfiddle.net/byybora/xhkku/4/
loading demo: http://jsfiddle.net/byybora/dbdax/43/
Comments
Post a Comment