npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jquery.yacsstooltip

v1.1.1

Published

Yet Another CSS Tooltip jQuery Plugin - Adds a CSS tooltip for the images in a jQuery selection set

Downloads

9

Readme

jquery.YACSSTooltip

Yet Another CSS Tooltip jQuery Plugin - Adds a CSS tooltip for the images in a jQuery selection set.

This small plugin (857 bytes minified and gzipped) adds a visible tooltip to any element with a title or alt attribute:

YACSSTooltip in action

It uses the text in the title attribute first or the text in alt in case the title is not available. To prevent the system's native tooltip to be shown, it disables the title if present, and restores it again after the CSS Tooltip has been hidden.

It takes into account the limits of the viewport so that it doesn't overflow through the right or the bottom. Takes into account long lines and wraps them.

Usage

You can download the minified, ready for production version of the plugin (in the dist folder of this repo) and just reference it from your HTML, after jQuery:

<script src="js/jquery.min.js"></script>
<script src="js/jquery.YACSSTooltip.min.js"></script>

Now, just select the elements you want to add the tooltip to and call the addTooltip method. For example:

$(function() {
    $('.article img').addTooltip();
});

Since its a well behaved jQuery plugin, you can make calls in a fluent way and act over the elements set after adding the tooltip. For example:

$(function() {
    $('.article img').addTooltip().css('border', '5px solid red');
});

in this case we're adding a red solid border to the images after activating the tooltip feature in them.

Check the index.html sample file in the root of this folder to see it in action.

That's it!

Look&Feel

Only one hidden element at the end of the body is used to show as many tooltips as are needed, so it doesn't fill your DOM.

This element has a random id to prevent collisions, and defines the default look&feel as an inline style so that you don't need to add any CSS files to your pages.

However, it has a .YACSSTooltip applied, so you can easily change any default property of the tooltip by adding a CSS selector for that class. You must use the !important modifier to override the inline styles. For example:

.YACSSTooltip {
    border-radius: 0 !important;
}

in order to remove the rounded borders.

Build the production version

In order to build the production version form the source you just need to run the npm build task defined in the package.json file:

npm run build

and it will generate the minified version and the debugging map inside the dist folder. It will automatically add the version in the package to the license comments in the file.

License

This software is released under the permissive MIT license. Check the details here.