【发布时间】:2015-02-18 00:21:53
【问题描述】:
所以,我想显示特定按钮的工具提示,而不是其他按钮。 这是我的代码示例,我想在悬停时显示带有“TAB”字样的工具提示,用于 TAB 按钮。但是,如果我将鼠标悬停在 FOO 和 BAR 等其他按钮上,它也会显示 TAB。我不确定是什么原因造成的?是否因为即使我为 TAB 输入了特定的 ID,它们也共享同一个类?
js函数:
$('#TabBtn').mouseover(function () {
BrowserSide.Objects.ToolTip("#TabBtn", "Tab");
}).mouseout(function () {
$("#TabBtn").qtip('destroy', true);
});
工具提示在哪里:
ToolTip:function(elementId,toolTipContent){
$(elementId).parent().mouseover(function (event) {
$(this).qtip({
overwrite: false,
content: toolTipContent,
once: false,
show: {
event: event.type,
delay: 500,
ready: true,
},
position: {
my: 'top center',
at: 'top center',
target: 'mouse',
adjust: {
x: 0,
y: -35,
mouse: true // Can be omitted (e.g. default behaviour)
}
},
style: {
classes: "qtip-tooltip-for-ellipse"
}
}, event);
});
}
HTML代码:
<button id="TabBtn" class='newUI-toolbar-button-with-icon' style="margin:10px 8px 5px 8px; width:40px !important; height:30px !important"><span id="toolbar-TAB" class="newUI-toolbar-button-label" style="position: relative; top: -2px">Tab</span></button>
<button class='newUI-toolbar-button-with-icon' style="margin:10px 8px 5px 8px; width:40px !important; height:30px !important"><span id="toolbar-FOO" class="newUI-toolbar-button-label" style="position: relative; top: -2px; left: -4px">Foo</span></button>
<button class='newUI-toolbar-button-with-icon' style="margin:10px 8px 5px 8px; width:40px !important; height:30px !important"><span id="toolbar-BAR" class="newUI-toolbar-button-label" style="font-size: 8px !important;position: relative; top: -3px; left: -4px">Bar</span></button>
【问题讨论】:
标签: javascript jquery css qtip2