Twine 1.4.2 Sugarcube 2 adding tooltip hover text with only Twine code?

0 votes
asked Jun 5 by Lillimint (160 points)
I'm trying to get a tooltip when I hover the mouse over a button or link, but would prefer to keep it in Twine code or HTML without going involving CSS or Javascript. Is there a way to do this? There's an existing system for images with [img[Tooltip|image]]. Does a similar one exist for other code?

1 Answer

+1 vote
answered Jun 5 by HiEv (4,700 points)
selected Jun 5 by Lillimint
 
Best answer

You can just put a "span" around the link and set the "title" attribute to whatever you want the hover text to be, like this:

<span title="Hover text">[[test]]</span>

That should do the trick for most things.

commented Jun 5 by Lillimint (160 points)
That works perfectly. Thanks so much.
commented Jun 6 by greyelf (88,870 points)

You can also use HTML Attributes to do the same with a HTML anchor element, however this will cause the related Passage Connection Arrow to disappear on the Passage Map if you are using one of the Twine (1.x or 2.x) applications.

<a data-passage="test" title="Hover text">Test</a>

 

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...