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

int-tooltip

v1.5.4

Published

IntTooltip is a simple jQuery-based library for opening a tooltip on a page at a specified element.

Downloads

21

Readme

IntTooltip

IntTooltip is a simple plug-and-play jQuery-based library for opening a tooltip on a page at a specified element. It is meant to be bundled with Browserify and bundles with CSS via the Browserify-CSS transform.

Features:

  • Tooltips poll their targets for changes in position or dimensions and automatically reposition themselves accordingly.
  • Tooltips can contain asynchronously loaded content, such as images, and will still position themselves correctly.

Warning: Currently, IntTooltip assumes that jQuery is globally accessible via $.

Example usage

const IntTooltip = require('int-tooltip');
const tooltip = IntTooltip.open('#some-button', {
  position: 'top',
  html: 'Hello world!',
  onClose: function(){
    console.log('closed!');
  }
});

IntTooltip

IntTooltip.open($target, opts)

Opens a tooltip around $target with opts. Closes all another tooltips unless opts.id is set.

  • $target: jQuery selection. Required. The element around which the tooltip will appear.
  • opts: Object. Optional. Configuration options for the tooltip. See Tooltip.constructor below.

Returns a tooltip instance. You can use this to append additional elements to the tooltip via tooltip.$container.

IntTooltip.bindButton($selection, opts)

When the user clicks $selection, a tooltip with opts will open.

IntTooltip.closeAll()

Closes all open tooltips. Executes if any tooltips are open and the user hits the escape key.

Tooltip

constructor($target, opts)

  • target: jQuery selection. Required. The element around which the tooltip will appear.
  • opts: Object. Optional. Configuration options.
  • opts.html: String. HTML to print to the tooltip.- opts.onClose: Function. Fires when this tooltip is closed.
  • opts.position: String. Optional. The preferred direction in which the tooltip will appear, relative to $target. Options: "top", "right", "bottom", "left". Defaults to "bottom". If part of the tooltip appears off-screen in this direction, it will try other directions.
  • opts.id: String. Optional. A unique identifier for the tooltip. Defaults to default. If opened via IntTooltip.open, any tooltip that shares this ID will be closed first.
  • opts.interval: Number or boolean. Optional. The frequency at which the tooltip should check the $target for a change in position or dimension. If false, no polling is conducted. Defaults to 1000.
  • opts.clickout: Boolean. Optional. If true, clicking outside the tooltip will close it. Default: false.

close()

Closes this tooltip.

reposition()

Repositions the tooltip.

CSS

To override any CSS rules, simply examine intTooltip.scss.

Testing

To test, run npm run build-test. Then, open test/test.html and visually check to the tooltip in all the test cases.