效果图:![](https://box.kancloud.cn/f51ba6333c797f64948f00329dd2125d_164x31.png)
```
input[name=sum] {
visibility: hidden
}
/*lable标签的大小、位置、背景颜色更改,在css选择时,“+”代表相邻元素,即当前元素的下一元素*/
#color-input-checkbox+label {
display: block;
width: 16px;
height: 16px;
cursor: pointer;
position: absolute;
top: 3px;
left: 120px;
border: 1px solid #d2d2d2;
/* border-radius: 50%; */
background: white;
}
/*当input框为选中状态时,lable标签的样式,其中在css选择时,“:”表示当前input框的值,即checked;
该部分主要对显示的“对号”的大限居中方式,显示颜色进行了设置*/
#color-input-checkbox:checked+label::before {
display: block;
width: 16px;
height: 16px;
content: "\2714";
text-align: center;
font-size: 16px;
color: #5FB878;
margin-top: -3px;
}
```
```
<div class="layui-form" style="position:absolute;left:350px;top:6px;z-index: 9999999;">
<div class="layui-form-item">
<input type="text" name="" placeholder="" maxlength="32" id="government-index-workcheck-refresh" autocomplete="off"
style="width:45px;display:inline-block;border: 1px solid #d2d2d2;"><span>秒自动刷新</span>
<input id="color-input-checkbox" type="checkbox" name="sum" lay-filter="bid-pipeline-scan-scans" >
<label for="color-input-checkbox"></label>
</div>
</div>
```
```
//刷新
//1.点击复选框,判断输入框里是否有值,若有值才点击复选框打开定时器
//2.在输入框输入值完成之后,定时器间隔时间根据输入框的值进行隔断刷新
//3.前两个条件都满足才进行定时刷新
var sums = $("input[name='sum']");
var refresh = $("#government-index-workcheck-refresh")
var timer;
sums.on('click', function () {
var times = refresh.val()*1000;
if (sums.is(':checked') == true&&refresh.val()!=""&&refresh.val()!=0) {
timer = setInterval(function () {
town.render();
org.render();
bid.render();
}, times);
} else {
clearInterval(timer);
}
})
refresh.on('change', function () {
clearInterval(timer);
var times = refresh.val()*1000;
if (sums.is(':checked') == true&&refresh.val()!=''&&refresh.val()!=0) {
timer = setInterval(function () {
town.render();
org.render();
bid.render();
}, times);
}
})
```