New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@yaireo/title-tooltip

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yaireo/title-tooltip

CSSsut

latest
Source
npmnpm
Version
1.2.1
Version published
Maintainers
1
Created
Source

title-tooltip script demo

Converts title attributes into tooltips

Title Tooltip

If you want to have custom tooltips and all you have now are title attribute, and you don't want to change anything in your markup, then this solution will automatically show ustom tooltips instead of your titles and all you need to do is style them (or use the default style here)

For the positioning of the tooltips, I would recommend using my super-lighweight script

Features:

  • Super lightweight
  • CSS customizability
  • Custom delay

Install:

Use from CDN / Download from this repo / NPM

npm i @yaireo/title-tooltip -S

🧐 This script should be accompanied by a DOM positioniong script. I intentionally did not couple one because you might be already using one in your project, or simply do not want one coupled. I recommend using another lib of mine for that (it's also used in the demo page and below code): https://github.com/yairEO/position

Usage:

Import CSS file via JS

import titleTooltip from '@yaireo/title-tooltip'

Import default CSS

@import '@yaireo/title-tooltip/title-tooltip.css'

Finally, execute the command to automatically transform the titles to tooltips:

// using "@yaireo/position" lib for positioning
titleTooltip({
  onShow: function(reference, popper){
    // ".default" is only needed when the script is loaded as a <script> tag and not as an ES2015 module
    position.default({
      target    : popper,
      useRaf    : false,
      ref       : reference,
      offset    : [0, 5],
      placement : "center below",
    })
  }
})

Keywords

tooltip

FAQs

Package last updated on 03 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts