扫码关注官方订阅号
鼠标移入test, 2秒后在中提示mouseenter.
test
鼠标移出test, 在中提示mouseleave.
要求leave的信息必须等mouseenter显示后,再显示(有顺序)。 应该怎么写事件?
Try this:
var $test = $('#test'), $info = $('#info'), status; $test.on('mouseenter',function(){ status = ""; $info.text('mouseenter').fadeOut(0).delay(2000).fadeIn(300, function(){ status === "out" ? $(this).text('mouseleave') : status = "in"; }); }); $test.on('mouseout',function(){ status === "in" ? $info.text('mouseleave') : status = "out"; });
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
Try this: