Wednesday, 15 May 2013

javascript - Bootstrap Progress Bar Start Value -



javascript - Bootstrap Progress Bar Start Value -

i using bootstrap progress bar looks nice. i've read on of documentation seen here https://github.com/minddust/bootstrap-progressbar.

i wondering if there simple way alter start value (so not 0), app every time. need dive javascript , jquery haven't gotten there yet.

so work simple:

<div class="progress progress-striped active"> <div class="progress-bar six-sec-ease-in-out" role="progressbar" aria-valuetransitiongoal="33"></div> </div>

is command view, , actual js comes here

$(window).ready(function(e){ $.each($('div.progress-bar'),function(){ $(this).css('width', $(this).attr('aria-valuetransitiongoal')+'%'); });

the goal utilize progress bar, where-in add together start values @ each of 3pages. page 1 0 (which default wouldn't need change) aria-valuetransitiongoal of 33. page 2 start @ 33% aria valuetransitiongoal of 66% etc. of now, set goal right value, each page load restarts value 0.

update: local storage best way...?

try setting width of "progress-bar".

<div class="progress progress-striped active"> <div class="progress-bar six-sec-ease-in-out" role="progressbar" style="width:33%"></div> </div>

you can set width dynamically via function phone call or variable (returning "value%" e.g. 20%).

style="width:' + variable/functioncall + '"

javascript jquery ruby-on-rails-3 progress-bar

No comments:

Post a Comment