请告诉我如何在jquery中关闭mouseleaving或mouseout函数的jquery对话框。我有一个盒子,当我的光标进入那个盒子对话框应该打开时,当光标离开那个盒子以及对话框然后对话框应该自动关闭。
谢谢,
这是我的代码,请告诉我在哪里更改,
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet"
href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$("#text,#dialog").mouseenter(function(){
$( "#dialog" ).dialog({
position: {
my: "left+25 top+20",
at: "left+25 top+20"}
});
} );
$("#text,#dialog").mouseout(function(){
$( "#dialog" ).dialog("close");
} );
});
</script>
</head>
<body>
<textarea id="text"></textarea>
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying
information. The dialog window can be moved, resized and closed with
the 'x' icon.</p>
</div>
</body>
</html>