我在Mozilla Firefox中的标准按钮上有问题(其他浏览器运行良好)。启用/禁用后,按钮始终变为蓝色(鼠标悬停)。
按钮脚本:
$(document).ready(function(){
$(".crbutton").click(function(){
$(this).prop("disabled",true);
setTimeout(function(){$(".crbutton").prop("disabled",false);}, 710);
});
});
CSS按钮:
.crbutton{
position: fixed;
width: 5%;
height: 5%;
right: 0%;
top: 47.5%;
}
如何解决此问题?
似乎相当简单。当您这样做时
$(document).ready(function(){
$(".crbutton").click(function(){
$(this).prop("disabled",true);
setTimeout(function(){$(".crbutton").prop("disabled",false);}, 710);
});
});
您只是在切换禁用状态。但是,该按钮仍然具有焦点,这就是为什么您在重新启用它时看到“活动”或“焦点”状态的原因,如此处所示:http : //jsfiddle.net/d8yqbcq2/。
要删除焦点,只需向添加呼叫.blur()
,如下所示:http : //jsfiddle.net/d8yqbcq2/2/
$(document).ready(function () {
$(".crbutton").click(function () {
$(this).prop("disabled", true);
setTimeout(function () {
$(".crbutton").prop("disabled", false);
}, 710);
$(this).blur(); // added this
});
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句