Jquery 启用/禁用后的Mozilla firefox按钮始终鼠标悬停
我对Mozilla Firefox中的标准按钮有一个问题(其他浏览器运行良好)。 启用/禁用按钮后始终变为蓝色(鼠标悬停) 按钮脚本:Jquery 启用/禁用后的Mozilla firefox按钮始终鼠标悬停,jquery,html,css,button,mozilla,Jquery,Html,Css,Button,Mozilla,我对Mozilla Firefox中的标准按钮有一个问题(其他浏览器运行良好)。 启用/禁用按钮后始终变为蓝色(鼠标悬停) 按钮脚本: $(document).ready(function(){ $(".crbutton").click(function(){ $(this).prop("disabled",true); setTimeout(function(){$(".crbutton").prop("disabled",false);}, 710);
$(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);
});
});
您只需切换禁用状态。但是,该按钮仍然具有焦点,这就是为什么在启用该按钮时会看到“活动”或“聚焦”状态,如下所示:
要移除焦点,只需添加对.blur()
的调用,如下所示:
我想你是说它有“活动”按钮样式?谢谢!但为什么按钮只在mozilla中启用/禁用后仍然集中???@user3931692不知道。我不知道有哪一个规范说明了当元素被禁用时浏览器应该如何处理焦点。
$(document).ready(function () {
$(".crbutton").click(function () {
$(this).prop("disabled", true);
setTimeout(function () {
$(".crbutton").prop("disabled", false);
}, 710);
$(this).blur(); // added this
});
});