以下代码来自dojo tooltipdialogue的标准示例。 当鼠标离开对话框时,我需要停止工具提示关闭的行为。有没有办法覆盖onMouseLeave事件以保持工具提示打开,直到用户在tooltipdialogue中单击一个按钮?
<!DOCTYPE html>
<html >
<head>
<link rel="stylesheet" href="../_static/js/dojo/../dijit/themes/claro/claro.css">
<script>dojoConfig = {parseOnLoad: true}</script>
<script src='../_static/js/dojo/dojo.js'></script>
<script>
require([
"dijit/TooltipDialog",
"dijit/popup",
"dojo/on",
"dojo/dom",
"dojo/domReady!"
], function(TooltipDialog, popup, on, dom){
var myTooltipDialog = new TooltipDialog({
id: 'myTooltipDialog',
style: "width: 300px;",
content: "<p>I have a mouse leave event handler that will close the dialog.",
onMouseLeave: function(){
popup.close(myTooltipDialog);
}
});
on(dom.byId('thenode'), 'mouseover', function(){
popup.open({
popup: myTooltipDialog,
around: dom.byId('thenode')
});
});
});
</script>
</head>
<body class="claro">
<div id="thenode">Move the mouse over me to pop up the dialog.</div>
答案 0 :(得分:0)
是。只需从onMouseLeave
声明中删除myTooltipDialog
事件处理程序即可。点击tooltipDialog
内的另一个按钮,关闭弹出窗口,无论您想要处理哪个事件。