function slider_changed(e) {
$(".progressBarInnerBody").css('width', e.target.value + "%");
}
.progressOuterBody {
border: 1px solid grey;
height: 25px;
border-radius: 64px;
padding: 3px;
}
.progressBarInnerBody {
position: relative;
width: 80%;
height: 100%;
background: dodgerblue;
/* For browsers that do not support gradients */
background-image: -webkit-linear-gradient(left, dodgerblue, dodgerblue);
/* For Safari 5.1 to 6.0 */
background-image: -o-linear-gradient(right, dodgerblue, dodgerblue);
/* For Opera 11.1 to 12.0 */
background-image: -moz-linear-gradient(right, dodgerblue, dodgerblue);
/* For Firefox 3.6 to 15 */
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
border-radius: 45px;
background-size: 60px 60px;
animation: barberpole 0.5s linear infinite;
}
.shade {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent;
/* For browsers that do not support gradients */
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5), transparent);
/* For Safari 5.1 to 6.0 */
background-image: -o-linear-gradient(right, rgba(0, 0, 0, 0.5), transparent);
/* For Opera 11.1 to 12.0 */
background-image: -moz-linear-gradient(right, rgba(0, 0, 0, 0.5), transparent);
/* For Firefox 3.6 to 15 */
border-radius: 45px;
}
@keyframes barberpole {
from {
background-position: 0 0;
}
to {
background-position: 60px 0;
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
</head>
<body>
<div class="progressOuterBody">
<div class="progressBarInnerBody">
<div class="shade">
</div>
</div>
</div>
<input type="range" id="slider" value="80" oninput="slider_changed(event)">
</body>
</html>
@SumnerEvans請參閱我code.I需要的背景顏色CSS。 –