Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
codex-tooltip
Advanced tools
Lightweight JavaScript module for adding tooltips with custom content to any HTML element
First, install it via package manager:
yarn add codex-tooltip
npm install codex-tooltip
Then, include tooltips to your script, create an instance and call hiding/showig methods:
import Tooltip from 'codex.tooltip';
const tooltip = new Tooltip();
tooltip.show(targetElement, 'Tooltip text');
There are two main methods: show()
and hide()
Method shows tooltip with custom content on passed element
tooltip.show(element, content, options);
parameter | type | description |
---|---|---|
element | HTMLElement | Tooltip will be showed near this element |
content | String or Node | Content that will be appended to the Tooltip |
options | Object | Some displaying options, see below |
Available showing options
name | type | action |
---|---|---|
placement | top , bottom , left , right | Where to place the tooltip. Default value is `bottom' |
marginTop | Number | Offset above the tooltip with top placement |
marginBottom | Number | Offset below the tooltip with bottom placement |
marginLeft | Number | Offset at left from the tooltip with left placement |
marginRight | Number | Offset at right from the tooltip with right placement |
delay | Number | Delay before showing, in ms. Default is 70 |
hidingDelay | Number | Delay before hiding, in ms. Default is 0 |
Method hides the Tooltip.
tooltip.hide();
import Tooltip from 'codex.tooltip';
const tooltip = new Tooltip();
const someButton = document.getElementById('some-button');
someButton.addEventListener('mouseenter', () => {
tooltip.show(someButton, 'Button helper');
});
someButton.addEventListener('mouseleave', () => {
tooltip.hide();
});
In example above we show tooltip near some button by "mouseenter" and hide by "mouseleave".
For this events you can also use the onHover()
decorator:
import Tooltip from 'codex.tooltip';
const tooltip = new Tooltip();
const someButton = document.getElementById('some-button');
tooltip.onHover(someButton, 'Button helper', {
placement: 'right',
delay: 150
})
CodeX is a team of digital specialists around the world interested in building high-quality open source products on a global market. We are open for young people who want to constantly improve their skills and grow professionally with experiments in cutting-edge technologies.
🌐 | Join 👋 | ||
---|---|---|---|
codex.so | codex.so/join | @codex_team | @codex_team |
FAQs
Simple tooltips module
We found that codex-tooltip demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.