我想在我的component.ts文件中写入特殊的输入范围函数,但是我对此还是个初学者。你能帮我吗?
JS:
document.getElementById("myinput").oninput = function() {
this.style.background = 'linear-gradient(to right, #82CFD0 0%, #82CFD0 '+this.value +'%, #fff ' + this.value + '%, white 100%)'
};
CSS:
#myinput {
background: linear-gradient(to right, #82CFD0 0%, #82CFD0 50%, #fff 50%, #fff 100%);
border: solid 1px #82CFD0;
border-radius: 8px;
height: 7px;
width: 356px;
outline: none;
transition: background 450ms ease-in;
-webkit-appearance: none;
}
HTML:
<div class="chrome">
<input id="myinput" type="range" value="50" />
</div>
我发现了this.style.background
错误,应该是(<HTMLElement>document.getElementById("myinput")).style
但我无法解决this.value
问题。