To obtain selector for secondary menu item, access your developer section of browser and “inspect” then “copy selector”.
Add the following code to the Layout Javascript tab:
function applyTooltip(selector, content) {
const element = document.querySelector(selector);
if (element) {
tippy(element, {
content: content,
trigger: 'mouseenter', // Change to 'focus' if needed
placement: 'right',
arrow: true,
animation: 'fade',
});
} else {
setTimeout(() => applyTooltip(selector, content), 100);
}
}
// Applying tooltips to multiple elements
applyTooltip('#layout_floating > div > div > aside > div > div > ul > li:nth-child(1)', 'Security');
applyTooltip('#layout_floating > div > div > aside > div > div > ul > li:nth-child(2)', 'Emergency Management/Business Continuity');
applyTooltip('#layout_floating > div > div > aside > div > div > ul > li:nth-child(3)', 'After Action Reports (AARs)');
Any confirmation would be appreciated or if there is a more concise/less lines of code that could be used. This was developed by trail and error using ChatGPT.
NOTE: there are limitations to this current setup. If you have dynamic links that show/hide based on roles, it could result in incorrect results.
~ Adam
Hi Adam, I can confirm your codes do work. Screenshot and link are attached for your attention. Only useful for ‘Floating’ layout in PC mode on mouse hover over event plus any new menu items would need coding in… right? All that effort just to get tooltips… or perhaps that is the very point you are conveying to the tb community beucase it should be a standard/optional feature for the Floating layout.
You are correct, that any additions or deletes would require updated coding. I am sure that the TB team is working on something similar for the layouts. This was intended to be an interim option for the Community members to use.
Thanks for checking and confirming it works for you.
Works great for me, so a big thankyou. Has anyone tried to generate code for the notifaction counter? I´ve been trying with chatGPT for a few hours but to no avail, i´ve generated a post if anyone is interested.
I use SnagIt and ScreenCast for my short videos on the TB Community board. They are simple and easy to use. Not a lot of “bells and whistles” which is sufficient for the Community Board.