如何自定义jquery滑块范围的颜色? [英] How to customize the color of the jquery slider range?

查看:72
本文介绍了如何自定义jquery滑块范围的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用jquery滑块时,我想将所选范围的默认颜色从灰色更改为蓝色。

When using the jquery slider, I would like to change the default color of the selected range from grey to blue.

$(document).ready(function () {

            var slider = $('.slider').slider({
                range: "min",
                min: 0,
                max: 100,
                change: function (e, ui) {
                    //                    $("#img1").fadeOut();
                    //                    alert("done");
                },
                slide: function (e, ui) {
                    var point = ui.value;
                    $("#selected_value").html(point);
                    var width = 100 - point;
                   $("#range").css({ "width": point + "%" });
                }

            });

my html:

<div>
        Min: <span id="selected_value">0</span><br />

    </div>
    <div>
        <div class="slider"><div id="range"></div></div>
    </div>

和我的css:

#range
{
    position:absolute;
    height:100%;
    top: 0;
    background-color:Blue;
}


推荐答案

您需要指定CSS:

div.ui-slider-range.ui-widget-header {
    background: blue;
}

如果您只想定位滑块的子集,请相应地限制选择器。

If you only want to target a subset of your sliders, restrict the selector accordingly.

查看实际操作

See it in action.

这篇关于如何自定义jquery滑块范围的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆