我可以在鼠标悬停时创建工具提示,但在mouseout上我的工具提示不会破坏或隐藏。
我正在使用以下代码。请提出更正建议。
<!DOCTYPE html>
<html>
<head>
<link href = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css"
rel = "stylesheet" />
<script type = "text/javascript"
src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
<script type = "text/javascript">
Ext.onReady(function() {
toolTip = new Ext.ToolTip ({
id : 'toolTip',
html : 'This is a basic toolTip'
});
Ext.create('Ext.Button', {
renderTo: Ext.getElementById('buttonId'),
text: 'Hover Me',
listeners: {
mouseover: function() {
toolTip.show();
}
}
});
});
</script>
</head>
<body>
<div id = "buttonId"></div>
</body>
</html>
提前谢谢。
答案 0 :(得分:0)
这适合我。
<!DOCTYPE html>
<html>
<head>
<link href = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css"
rel = "stylesheet" />
<script type = "text/javascript"
src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
<script type = "text/javascript">
Ext.onReady(function() {
new Ext.button.Button({
renderTo: Ext.getBody(),
text: 'Click',
tooltip: 'Tooltip',
tooltipType: 'title'
});
});
</script>
</head>
<body>
<div id = "buttonId"></div>
</body>
</html>