Try something like this (I answered before you modified your question)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<style>
input[type=range] {
margin: auto;
outline: none;
padding: 0;
width: 640px;
height: 10px;
background-color: #dedede;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ff1100), color-stop(100%, #ff1100));
background-size: 50% 100%;
background-repeat: no-repeat;
border-radius: 10px;
cursor: pointer;
-webkit-appearance: none;
}
input[type=range]::-webkit-slider-runnable-track {
box-shadow: none;
border: none;
background: transparent;
-webkit-appearance: none;
}
input[type=range]::-webkit-slider-thumb {
height: 18px;
width: 18px;
border: 0;
background: #fff;
border: 1px solid #777;
border-radius: 20px;
box-shadow: 0 0 1px 0px rgba(0, 0, 0, 0.1);
-webkit-appearance: none;
}
</style>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="range" min="1" max="100" value="1" />
</body>
<script>
$('input[type=range]').on('input', function (e) {
var min = e.target.min,
max = e.target.max,
val = e.target.value;
if (val < 34) {
$(e.target).css({
'background-image': '-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, red), color-stop(100%, red))'
});
}
if (val > 34 && val < 64) {
$(e.target).css({
'background-image': 'linear-gradient(to right, red , yellow)'
});
}
if (val > 64) {
$(e.target).css({
'background-image': 'linear-gradient(to right, red , yellow,green)'
});
}
$(e.target).css({
'backgroundSize': (val - min) * 100 / (max - min) + '% 100%'
});
}).trigger('input');
</script>
</html>
You can see it working here:
$('input[type=range]').on('input', function (e) {
var min = e.target.min,
max = e.target.max,
val = e.target.value;
if (val < 34) {
$(e.target).css({
'background-image': '-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, red), color-stop(100%, red))'
});
}
if (val > 34 && val < 64) {
$(e.target).css({
'background-image': 'linear-gradient(to right, red , yellow)'
});
}
if (val > 64) {
$(e.target).css({
'background-image': 'linear-gradient(to right, red , yellow,green)'
});
}
$(e.target).css({
'backgroundSize': (val - min) * 100 / (max - min) + '% 100%'
});
}).trigger('input');
input[type=range] {
margin: auto;
outline: none;
padding: 0;
width: 640px;
height: 10px;
background-color: #dedede;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ff1100), color-stop(100%, #ff1100));
background-size: 50% 100%;
background-repeat: no-repeat;
border-radius: 10px;
cursor: pointer;
-webkit-appearance: none;
}
input[type=range]::-webkit-slider-runnable-track {
box-shadow: none;
border: none;
background: transparent;
-webkit-appearance: none;
}
input[type=range]::-webkit-slider-thumb {
height: 18px;
width: 18px;
border: 0;
background: #fff;
border: 1px solid #777;
border-radius: 20px;
box-shadow: 0 0 1px 0px rgba(0, 0, 0, 0.1);
-webkit-appearance: none;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="range" min="1" max="100" value="1" />