Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Documentation and examples for adding custom Bootstrap tooltips with CSS and JavaScript using CSS3 for animations and data-bs-attributes for local title storage.

...

Bootstrap Tooltips are often used to specify extra information about something when the user moves the mouse pointer over an HTML element. Refer to the below URL for more information on Bootstrap Tooltips.

Enabling Tooltips

  • Go to Appearance > Settings > Theme

  • Under Bootstrap Settings select the Tooltips tab

  • Select Tooltips (Enable tooltips everywhere)

  • Click Save Configuration at the bottom of the page

Creating Tooltips

  • Go to Appearance > Settings > ThemeUnder Bootstrap Settings select the Tooltips tabto the page where you would like to add a Tooltip. The below code is an example of a Tooltip. For a LIVE example of this. Refer to https://drupal.maricopa.edu/example-pages/various-bootstrap-elements

    Code Block
    <button type="button" class="btn btn-secondary"
            data-bs-toggle="tooltip" data-bs-placement="top"
            data-bs-custom-class="custom-tooltip"
            data-bs-title="This top tooltip is themed via CSS variables.">
      Custom tooltip
    </button>
  • Copy and paste this code

If your using a Tooltip as an HTML link. Copy and paste the below code:

Code Block
 <span role="button" class="text-decoration-underline text-secondary" 
          data-bs-custom-class="custom-tooltip" data-bs-placement="top" 
          data-bs-title="This top tooltip is themed via CSS variables." 
          data-bs-toggle="tooltip">
  Custom tooltip
 </span>
Info

If using CKEditor to add your Tooltip, refer back to creating Text Formats on how to switch between Basic HTML and Full HTML mode. CKEditor must be in FULL HTML mode for tooltips to work on your page.