所以我有这个代码:
$(document).ready(function(){
$('#nexButton').mouseenter(function(){
$('#nexButton').stop().animate({opacity: '1'},'fast');
$('#nexButton').mouseleave(function(){
$('#nexButton').stop().animate({opacity: '0.7'},'fast');
});
});
$('#bacButton').mouseenter(function(){
$('#bacButton').stop().animate({opacity: '1'},'fast');
$('#bacButton').mouseleave(function(){
$('#bacButton').stop().animate({opacity: '0.7'},'fast');
});
});
});
在我的 javascript 和 nexButton 中,它运行完美,但在 bacbutton 中,当我仍在按钮上时,它只是回到 0.7 不透明度?!我做错了什么?
最佳答案
你可以试试这个:
$(document).ready(function(){
$('#nexButton, #bacButton')
.on('mouseenter', function(){
$(this).animate({opacity: '1'}, 'fast');
})
.on('mouseleave', function(){
$(this).animate({opacity: '0.7'},'fast');
});
});
这是FIDDLE .
关于javascript - (jQuery & JavaScript) animate 返回原始状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32682771/