javascript 如何在禁用模式下停止按钮的悬停效果
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11327708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 12:47:22 来源:igfitidea点击:
how to stop hover effect for button in disable mode
提问by user1501278
how to stop hover effect for button in disable mode. i can not stop hover effect after button in disabled i have tried but that is not working properly,please help me, where i want to change to get good results.
如何在禁用模式下停止按钮的悬停效果。在禁用按钮后,我无法停止悬停效果我已经尝试过,但无法正常工作,请帮助我,我想在何处更改以获得良好的结果。
<div id="prevnexts">
<button id="prevs" class="navButs tprev" disabled="">Prev</button>
<button id="nexts" class="navButs tnext" enabled="enabled">Next</button>
</div>
CSS
CSS
#prevnexts {
height: 22px;
left: 50px;
position: absolute;
top: 160px;
width: 75px;
}
#prevnexts .tnext, #prevnexts .tprev {
background: url("images/next1.png") no-repeat scroll 0 0 transparent;
border: 1px solid transparent;
height: 25px;
text-indent: -9999px;
width: 33px;
cursor:pointer;
}
button[disabled]:active, button[disabled],
input[type="reset"][disabled]:active,
input[type="reset"][disabled],
input[type="button"][disabled]:active,
input[type="button"][disabled],
select[disabled] > input[type="button"],
select[disabled] > input[type="button"]:active,
input[type="submit"][disabled]:active,
input[type="submit"][disabled]
{
opacity:0.5;
}
#prevnexts .tprev
{
background:url(images/prev1.png) no-repeat 0 0;
}
#prevnexts .tprev:hover
{
background:url(images/prev1hover.png) no-repeat 0 0;
}
#prevnexts.tnext:hover
{
background:url(images/next1hover.png) no-repeat 0 0;
}
javascript:
javascript:
$(document).ready(function() {
var cnt = 1;
var maxLinkss =<?php echo $mypostall; ?>;
$("#prevs").attr("disabled","disabled");
$(".tprev:hover").remove();
$("#nexts").attr("enabled","enabled");
$(".navButs").click(function(){
if (this.id=="nexts") {
cnt++;
console.log(" + ",cnt);
}
else {
cnt--;
console.log(" - ",cnt);
}
if (cnt<0) cnt=0;
if (cnt>maxLinkss-1) {
$("#nexts").attr("disabled","disabled");
}
else {
$("#nexts").removeAttr("disabled");
}
if (cnt==1) {
$("#prevs").attr("disabled","disabled");
}
else {
$("#prevs").removeAttr("disabled");
}
});
});