jQuery: mouseleave() method
Phương thức mouseleave() được kích hoạt khi người dùng di chuyển chuột rời khỏi phần tử HTML.
Ví dụ:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://ajax.googleapis. com/ajax/libs/jquery/1.10.2 /jquery.min.js">
</script>
<script>
$(function(){
$("div").mouseleave( function(){
$(this).hide(1000);
});
});
</script>
<style>
div{
width:50%;
height:50px;
text-align:center;
background:green;
color:white;
cursor:pointer;
}
</style>
</head>
<body>
<div>Di chuyển chuột dời khỏi tôi => Tôi ẩn</div>
</body>
</html>