change color of ion range-slider handle

Philipp Chapkovski picture Philipp Chapkovski · Dec 12, 2018 · Viewed 7.2k times · Source

If I try to change the default color of ion range-slider (available here: https://github.com/IonDen/ion.rangeSlider) from red (default) to blue, like that:

.irs-slider.single {
    background: blue;
}

It becomes square:

enter image description here

(originally it looks like a thin red line: enter image description here)

What am I doing wrong?

DEMO

https://jsfiddle.net/chapkovski/xpvt214o/995048/

Answer

Manthan Patel picture Manthan Patel · May 30, 2019

Below snippet for change whole ion range slider color to any color

$(".js-range-slider").ionRangeSlider({
  type: "single",
  min: 0,
  max: 1000,
  from: 200,
  to: 500,
  grid: true
});
    .irs--flat .irs-handle>i:first-child {
    background-color: #4e73df!important;//Replace With Your color code
}
.irs--flat .irs-bar {
    background-color: #4e73df!important;//Replace With Your color code
}
.irs--flat .irs-from, .irs--flat .irs-to, .irs--flat .irs-single {
    background-color: #4e73df!important;//Replace With Your color code
}
.irs--flat .irs-from:before, .irs--flat .irs-to:before, .irs--flat .irs-single:before {
    border-top-color: #4e73df!important;//Replace With Your color code
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.0/css/ion.rangeSlider.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.0/js/ion.rangeSlider.min.js"></script>
<input type="text" class="js-range-slider" name="my_range" value="" />