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

tooltipster-follower

v0.1.5

Published

A Tooltipster plugin to make the tooltip follow the cursor.

Downloads

3,217

Readme

tooltipster-follower

Follower is a Tooltipster plugin to make tooltips follow the cursor. MIT license.

Installation

Include the javascript plugin file in your page AFTER Tooltipster's file. Also include Follower's CSS file.

<html>
  <head>
    ...
    <link rel="stylesheet" type="text/css" href="tooltipster/dist/css/tooltipster.bundle.min.css" />
    <link rel="stylesheet" type="text/css" href="tooltipster-follower/css/tooltipster-follower.min.css" />
    ...
    <script type="text/javascript" src="tooltipster/dist/js/tooltipster.bundle.min.js"></script>
    <script type="text/javascript" src="tooltipster-follower/js/tooltipster-follower.min.js"></script>
  </head>
</html>

If you have no tooltips using sideTip in your page, you may use Tooltipster's core files instead of the bundle ones.

Usage

Declare the follower plugin in the options of the tooltips you want to follow the cursor, instead of sideTip:

$('.tooltip').tooltipster({
    plugins: ['follower']
});

That's it! You should see your tooltip follow the mouse, at the bottom-right of the cursor.

Themes

Follower has the same default style and themes as Tooltipster's sideTip. They are all included in tooltipster-follower.min.css, so you don't need to include any other files.

To create your own style, create a sub-theme as explained in Tooltipster's documentation. The only difference is that you replace .tooltipster-sidetip by .tooltipster-follower in your rules.

Options

minWidth The minimum width of the tooltip. Default: 0

maxWidth The maximum width of the tooltip. Default: null

offset The position of the anchor in the coordinate system, in the form [x,y] (see the illustration below). Default: [15,-15]

anchor The anchor is the point of the tooltip which ties it to the coordinate system (see the illustration below). There are eight possible values: top-left, top-center, top-right, left-center, left-right, bottom-left, bottom-center, bottom-right. Default: top-left

All of Tooltipster's options, methods and events remain available. Only sideTip's features will be unavailable on tooltips that use Follower instead (read this note).

Examples

$('.tooltip').tooltipster({
	anchor: 'bottom-left',
    minWidth: 200,
    maxWidth: 300,
    offset: [20, 20],
    plugins: ['follower'],
    theme: 'tooltipster-noir'
});

Figures

Events

follow events are fired when the position of the tooltip is set. It has event, helper and position properties, as well as an edit property which is a function that you may use to edit the coordinates of the tooltip.

position events are fired when Tooltipster asks Follower to re-evaluate the position of the tooltip, just like sideTip. Although we kept sideTip's original name for this event, it can be misleading as it is not fired every time the tooltip actually moves (use the follow events for that). The event has event, helper and position properties, and an edit property which is a function you can use to edit the proposed size of the tooltip.