dev

AjaxTooltips displays tooltips when you hover over links. The tooltips' contents are taken from the link's page. The difference between this script and LinkPreview is only the contents inside <div class="tooltip-content"></div> are displayed.

Installation

Step 1: Import the script

Step 2: Apply class="tooltip-content"

For the contents you want to display as the tooltip, put it inside <div class="tooltip-content"></div>.

Step 3: Create the tooltip template

Create the page Template:Ajaxtt with the following code:

[[{{{1}}}|<span class="ajaxttlink">{{{2|{{{1|}}}}}}</span>]]

Usage

To make a link with tooltip, use {{Ajaxtt|page|title}} on any page, where:

Error message customization

When the page of the link does not have content for the tooltip, the tooltip will be displayed as "This target either has no tooltip or was not intended to have one". You can customize that message with this CSS:

.ajaxtt-error {
    background-color: var(--theme-accent-color);
    color: var(--theme-page-text-color);
    padding: 5px;
}

See also

Text above can be found here (edit)