我正在尝试为我的网站创建自定义复选框,并且它适用于> IE9和其他浏览器。但正如预期在IE8或7。这里是我的CSS它不工作IE8/IE7中的自定义复选框
input[type="checkbox"] + label span {
height: 13px;
width:13px;
display: inline-block;
cursor: pointer;
background: url("../img/icons.png") no-repeat;
vertical-align: text-top;
margin-right: 6px;
background-position: -57px -118px;
}
input[type="checkbox"]:checked + label span{
background-position: -70px -106px;
}
<input type="checkbox" id="chkbox1" value="1" onclick="alert('clicked');">
<label for="chkbox1"><span></span>Checkbox1</label>
它可以在最新的浏览器很好,我下载了回退到selectivizr.js:检查伪选择在IE8/7的工作,但问题是当我点击复选框时,复选框的状态似乎没有任何变化,甚至没有捕获到onclick事件。任何帮助将不胜感激。
奇怪的是onclick事件在不触发。 z-index是否有可能导致问题? – Matt