【问题标题】:jQuery UI: How to make a multi colored ProgressBar? Segments colored differentlyjQuery UI:如何制作多色 ProgressBar?不同颜色的段
【发布时间】:2014-07-28 04:55:09
【问题描述】:
<script type="text/javascript">
        $(function() {
                $("#progressbar").progressbar({
                        value: 35
                });
        });
        </script>
<div id="progressbar">  </div>

代码取自:jQuery UI: How to change the color of a ProgressBar?

为了让问题更清楚:我希望进度条有段,它们应该是 0% - 59% 的绿色,60% - 89% 的黄色和 90% - %100% 的红色。

【问题讨论】:

标签: javascript jquery html


【解决方案1】:

您可以使用 jquery.ui.multiprogressbar.js 做到这一点。

为了给进度条设置不同的颜色,创建一组我在演示中使用的类并将其设置为 barClass

Demo

    $('#plain').multiprogressbar({
       parts: [
        {value: 59,barClass: "green"},
       {value: 30,barClass: "yellow"},
       {value: 11,barClass: "red"}]
});

【讨论】:

    猜你喜欢
    • 2010-12-01
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-28
    • 1970-01-01
    • 2011-02-07
    相关资源
    最近更新 更多