Tooltip BB Code

Akimbo

Member
You can do that with a custom BB Code.

1605986872442.png

Very much appreciated, thank you. I was experimenting with this and realized that a hint is required so the reader knows to do a mouseover. I just wrapped the BB code syntax using the editor's color tool because my hacks at trying to include color in your HTML code failed:

1606089997320.png

It is great that the cursor doesn't change so the reader knows (or learns) not to click on it.

Syntax hack in example above:
Code:
[COLOR=rgb(41, 105, 176)][tooltip="Built-ln Breathing System"]BlBS[/tooltip][/COLOR]

IF the tooltip suggestion is accepted, it would be ideal if the color for hyperlinks were also included.

Thinking out loud: I wonder if the syntax would be better if it was closer to HTML's for adding a tooltip to a url?
Code:
<a href="https://www.scubaboard.com" title="Click for ScubaBoard’s Home Page">Tons of information on Scuba diving</a>

1606091653065.png

I imagine xenForo would have a popup dialog box like they do for links in the editor so the BB code syntax wouldn't matter so much.
 
I've split the post off to stop the suggestion thread being derailed.

If you want to style the text which triggers the tooltip, you can do this:

1606093174430.png

HTML:
<span data-xf-init="tooltip" title="{option}">
    <span style="color: orange">{text}</span>
</span>

1606093219283.png

Basically span the {text} element and style it as you wish.

If you also want it underlined, you would do this:

HTML:
<span data-xf-init="tooltip" title="{option}">
    <span style="color: orange; text-decoration: underline">{text}</span>
</span>

If you wanted to also add a pointer to indicate it's a "link" then you would use:

HTML:
<span data-xf-init="tooltip" title="{option}">
    <span style="color: orange; text-decoration: underline; cursor: pointer">{text}</span>
</span>
 
I apologize for not letting you see the results earlier. I tweaked your suggestion a little so people would know to mouseover the target.


I named it sbtooltip in case xenForo ever makes a native tooltip function that uses a simpler syntax.

Code:
<span data-xf-init="sbtooltip" title="{option}"xspan style="color:blue">{text}</span></span>

Thanks again!
 
Back
Top Bottom