Advance Tooltip on Text
yoyoTooltip({
id: '#top',
direction: 'top',
content: 'π Hello Worlds',
});
yoyoTooltip({
id: '#text',
direction: 'top',
content: 'π <strong>Advance Tooltip</strong>> on text',
delay: 0,
trigger: 'hover',
backgroundColor: '#ff0000',
color: '#ffffff',
boxShadow: 'rgba(240, 46, 170, 0.4) 5px 5px, rgba(240, 46, 170, 0.3) 10px 10px, rgba(240, 46, 170, 0.2) 15px 15px, rgba(240, 46, 170, 0.1) 20px 20px, rgba(240, 46, 170, 0.05) 25px 25px',
targetHighlight: true,
targetTextDecoration: 'underline wavy black 2px',
targetUnderlineOffset: '10px',
targetBackgroundColor: 'yellow',
targetFontWeight: 'bold',
});
npm install yoyo-tooltip
yarn add yoyo-tooltip
import { yoyoTooltip } from './node_modules/yoyo-tooltip/dist/yoyoTooltip.min.mjs';
<script src="./node_modules/yoyo-tooltip/dist/yoyoTooltip.umd.min.js"></script>
<!-- jsDelivr CDN -->
<script src="https://cdn.jsdelivr.net/gh/smallvi/yoyoTooltip@latest/dist/yoyoTooltip.umd.min.js"></script>
<!-- unpkg CDN -->
<script src="https://unpkg.com/yoyo-tooltip@latest/dist/yoyoTooltip.umd.min.js"></script>
import { yoyoTooltip } from 'path/to/yoyoTooltip.min.mjs';
<script src="path/to/yoyoTooltip.umd.min.js"></script>
yoyoTooltip({
id: '#top',
direction: 'top',
content: 'π Hello Worlds',
});
yoyoTooltip({
id: '#text',
direction: 'top',
content: 'π <strong>Advance Tooltip</strong>> on text',
delay: 0,
trigger: 'hover',
backgroundColor: '#ff0000',
color: '#ffffff',
boxShadow: 'rgba(240, 46, 170, 0.4) 5px 5px, rgba(240, 46, 170, 0.3) 10px 10px, rgba(240, 46, 170, 0.2) 15px 15px, rgba(240, 46, 170, 0.1) 20px 20px, rgba(240, 46, 170, 0.05) 25px 25px',
targetHighlight: true,
targetTextDecoration: 'underline wavy black 2px',
targetUnderlineOffset: '10px',
targetBackgroundColor: 'yellow',
targetFontWeight: 'bold',
});
Description | |
---|---|
id |
The ID of the target element. |
content |
The text content to be displayed. |
directionOptional |
Specifies the direction in which the content should appear relative to the target element.('top', 'right', 'left', or 'bottom'). The default is 'top' |
delayOptional |
Specifies the delay before the content appears, in milliseconds.For example, 1000 equals 1 second. The default is 0 (no delay). |
triggerOptional |
Specifies the event that triggers the content to appear('hover', 'click'). The default is 'hover' |
backgroundColorOptional |
Specifies the background color of the content.The default color is black. |
colorOptional |
Specifies the text color of the content.The default color is white. |
boxShadowOptional |
Specifies the box shadow of the content. This can be used to add depth or a shadow effect. |
targetHighlightOptional |
Indicates whether the target element should be highlighted when the content appears.(true, false). The default color is white. |
targetTextDecorationOptional |
Specifies the text decoration (such as underline, overline, etc.) of the target element when the content appears. |
targetUnderlineOffsetOptional |
Specifies the distance of the underline from the text when text decoration is applied.(true, false) |
targetBackgroundColorOptional |
Specifies the background color of the target element when the content appears. |
targetFontWeightOptional |
Specifies the font weight of the target element when the content appears. |