Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@br0ken/simpletooltip
Advanced tools
simpleTooltip - the analogue or a lite-version of Tipsy Tooltip.
Most part of the development is implemented in CSS, but the role of controller performs a small JavaScript library.
Use of tooltip is possible on any HTML element. Just add the data-shift
and data-title
attributes to it. Value of the first one must be a predefined word that affects the positioning of a tooltip relative to the element to which it's given. The second - text of a tooltip (markup isn't supported).
Possible values for the data-shift
and their impact on a shift:
Value | Tooltip direction |
---|---|
nw | Northwest |
north | North |
ne | Northeast |
west | West |
east | East |
sw | Southwest |
south | South |
se | Southeast |
var params = {
shift: 'west',
title: 'Some text for displaying'
};
/**
* For {Element}.
*/
document.getElementById('id').simpleTooltip(params);
/**
* For {NodeList}.
*/
document.querySelectorAll('.class a').simpleTooltip(params);
/**
* For {jQuery}.
*/
jQuery('.class a').simpleTooltip(params);
Note, the parameter to .simpleTooltip()
must be an object that might contain shift
and/or title
. You can reimburse lack of parameters by setting them as attributes to HTML element (data-shift
and/or data-title
or title
).
Examples with incomplete list of parameters:
<span title="Some value"></span>
<script>
document
.querySelectorAll('span')
.simpleTooltip({shift: 'south'});
</script>
<!-- CSS class is used only for example. -->
<div class="set-tooltip" data-shift="west"></div>
<script>
document
.querySelectorAll('.set-tooltip')
.simpleTooltip({title: 'Some nice text'});
</script>
Functions of the plugin aren't numerous. Initially performs a check for positioning the elements that have a tooltip - it shouldn't be static. For this reason, all non-conforming elements receive relative
positioning.
When you hover the mouse over an element, its width gets calculated. If it's not more than maximal and tooltip not directed to south or north - plugin will do nothing more, otherwise:
FAQs
CSS tooltips with position control via JS.
The npm package @br0ken/simpletooltip receives a total of 1 weekly downloads. As such, @br0ken/simpletooltip popularity was classified as not popular.
We found that @br0ken/simpletooltip 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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.