I have a requirement to display tooltips only for specific buttons and not for others. I am facing an issue where the tooltip intended for the TAB button is showing up when hovering over other buttons like FOO and BAR as well. Could this be due to them sharing the same class even though TAB has a unique ID?
This is how I've implemented it:
$('#TabBtn').mouseover(function () {
BrowserSide.Objects.ToolTip("#TabBtn", "Tab");
}).mouseout(function () {
$("#TabBtn").qtip('destroy', true);
});
The Tooltip function is defined as follows:
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);
});
}
Here is the relevant HTML code snippet:
<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>