在jQuery中拖动鼠标后,mouseleave处理程序停止工作
我使用了一些jQuery来创建淡入淡出的滚动效果,但在执行单击和拖动之后,按钮的行为出现了问题在jQuery中拖动鼠标后,mouseleave处理程序停止工作,jquery,html,css,hover,Jquery,Html,Css,Hover,我使用了一些jQuery来创建淡入淡出的滚动效果,但在执行单击和拖动之后,按钮的行为出现了问题 <div id="splash_buttons"> <a id="our_projects_button" href="#work"> Our Projects <div class="normal"></div> <div class="hover"></div>
<div id="splash_buttons">
<a id="our_projects_button" href="#work">
Our Projects
<div class="normal"></div>
<div class="hover"></div>
</a>
</div>
我不确定这是否与正常状态和悬停状态由jQuery处理这一事实有关,而活动状态只是一个css规则。有人能帮忙吗?谢谢大家!
#our_projects_button {
float: left;
position: relative;
left: -6px;
width: 173px;
height: 53px;
margin: 0 20px 0 0;
text-indent: -9999px;
}
#our_projects_button .normal {
position: absolute;
top: 0;
left: 0;
width: 173px;
height: 53px;
background: url('img/our_projects_sprite.png') transparent 0 0 no-repeat;
}
#our_projects_button .hover {
display: none;
position: absolute;
top: 0;
left: 0;
width: 173px;
height: 53px;
background: url('img/our_projects_sprite.png') transparent 0 -53px no-repeat;
}
#our_projects_button .hover:active { background-position: 0 -106px; }
如果您将dragend代码更改为
.on('dragend', function() {
$(this).find('.normal').show();
$(this).find('.hover').stop().fadeOut(hoverFadeTime);
isMouseDown = false;
});
成功了!谢谢你抓住了!
.on('dragend', function() {
$(this).find('.normal').show();
$(this).find('.hover').stop().fadeOut(hoverFadeTime);
isMouseDown = false;
});