有没有办法在jQuery中停止fadeOut()动画mouseleave?我希望脚本的工作方式如下:
这就是我正在做的事情:
$(document).ready(function(){
$('.this').hover(function(){
$('#container').fadeIn(200);
}).mouseleave(function(){
setTimeout(function () {
$('#container').fadeOut(200);
}, 1000);
})
$('#container').hover(function(){
$('#container').stop().show();
})
});
Run Code Online (Sandbox Code Playgroud)
像这样?http://jsfiddle.net/y36ta/6/
var $container = $('#container');
$('.this').on('mouseover', function(){
$container.stop(true).fadeIn(200);
}).on('mouseleave', function(){
$container.stop(true).delay(200).fadeOut(200);
})
$container.on('mouseenter', function(){
$(this).stop(true).clearQueue().show();
}).on('mouseleave', function() {
$(this).delay(200).fadeOut(200);
});
Run Code Online (Sandbox Code Playgroud)
更新:用于.on()绑定处理程序.
| 归档时间: |
|
| 查看次数: |
2703 次 |
| 最近记录: |