Is there a way to show the percentage number insid

2019-03-22 02:10发布

问题:

Does jQuery UI support showing the number inside the Progressbar, like this:

回答1:

Not to drudge up an old thread, but I was attempting this earlier tonight and used the following in my CSS:

.progressBarClass{ 
    height:20px;
    width:300px;
    margin:0 auto;
}   

.progressBarClassspan { 
    width:300px;
    position:absolute;
    text-align:center;
    font-weight:bold;
}   

And have the following in my HTML:

<script type="text/javascript">
        $(function() {
             $( ".progressBarClass" ).progressbar({
                  value: 50
             });
        });
</script>

<div class="progressBarClass"><span>50%</span></div>

Does the trick for me, although I need to come up with a better method to allow for percentages on the .ui-progressbar class instead of fixed values.



回答2:

If it isn't any official way, you can add it. Just inspect the generated code with FireBug on Mozzila, get the id/class of the container and add the numbers in there yourself.

I never used jQuery UI's progressbar so I can't do that right now, but I'm sure it's not hard...