minddust / bootstrap-progressbar

progressbar interactions for twitter bootstrap 2 & 3
www.minddust.com/project/bootstrap-progressbar
MIT License
577 stars 160 forks source link

Is there any way to show the percentage value to a defined class? #38

Closed sohan5005 closed 10 years ago

sohan5005 commented 10 years ago

I'm trying to make a progressbar which has a title inside and percentage value side of there.

So my markup is like this:

                    <!--Progress bar-->
                    <div class="progress">
                        <div class="progress-bar" role="progressbar" aria-valuetransitiongoal="95" aria-valuemin="0" aria-valuemax="100">
                            Title<span>95%</span>
                        </div>
                    </div><!--Progress bar-->

When I use this : $('.progress-bar').progressbar({display_text: 'center'}); my title goes away and the too. What I want is to keep my title and show the percentage value inside the . Is it possible?

Thanks Sohan

sohan5005 commented 10 years ago

Figured it out. In this case I had to edit your code a little bit.

at the line 120, instead of "$this.text(text);" I had to use "$this.find('span').text(text);"

Can I edit and use your code like this?

minddust commented 10 years ago

sure you can but there a hook for that case so you don't need to do this. check out the demo page for a working example:

http://www.minddust.com/project/bootstrap-progressbar/demo/bootstrap-3-1-1/#m-custom-percentage-format