Display value in jQueryUI ProgressBar

前端 未结 6 1676
滥情空心
滥情空心 2020-12-14 07:13

I\'ve set up a simple jQuery UI ProgressBar:



        
6条回答
  •  天涯浪人
    2020-12-14 08:04

    This solution allows for a flexible width based on the text as well as centering the text, styling the text, etc. Works in Chrome, FF, IE8, and IE8 in compatibility mode. Didn't test IE6.

    Html:

     
    70%

    Script:

    $(".progress").each(function() {
        $(this).progressbar({
            value: 70
        }).children("span").appendTo(this);
    });
    

    CSS:

    .progress.ui-progressbar {position:relative;height:2em;}
    .progress span {position:static;margin-top:-2em;text-align:center;display:block;line-height:2em;padding-left:10px;padding-right:10px;}
    .progress[aria-valuenow="0"] span {margin-top:0px;}​
    

    Working sample: http://jsfiddle.net/hasYK/

提交回复
热议问题