Is there a way to show the percentage number inside the jQuery UI Progressbar?

我是研究僧i 提交于 2019-12-21 02:53:26

问题


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...



来源:https://stackoverflow.com/questions/3896891/is-there-a-way-to-show-the-percentage-number-inside-the-jquery-ui-progressbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!