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-pictip

v1.1.0

Published

Add handy tooltips to your images, slideshows, sliders and more

Downloads

7

Readme

jQuery PicTip

jQuery PicTip is a plugin that adds handy tooltips to your images, slideshows, sliders and more.

Features

  • Easy configuration and customization
  • Easy integration with slideshows, sliders, 360 views, and more
  • Support for captions and bubble tooltips
  • Add any content type to tooltips/captions
  • Event type options (hover/click)
  • Change tooltip position relative to spot
  • Create spots with your own HTML markup
  • CSS transitions/Animations are supported
  • Built with performance in mind
  • Responsive-friendly
  • Very small (just 4kb minified)

Getting Started

  • Include the jQuery library and the PicTip plugin on your page. It can also be installed using Bower or npm:
bower install jquery-pictip
npm install jquery-pictip
  • Call the pictip() method on the jQuery element that contains your image(s). Let me show you an example:

The HTML

<div id="pictip-demo"> </div>

The CSS

#pictip-demo{
    position: relative;
}
.spot{
  /* make it look pretty */
}
.spot-tooltip{
  /* make it look pretty */
}

Use the following clases for customization:

| Class | Description | | -------------------- |:----------------------------------------------------------------------------- | | spot | Spot class | | spot-{index} | Class containing the spot indetifier (spot-0, spot-1, etc) | | spot-open | Class assigned to the spot when the related tooltip is open | | spot-tooltip | Tooltip class | | spot-tooltip-{index} | Class containing the tooltip indetifier (spot-tooltip-0, spot-tooltip-1, etc) | | spot-tooltip-close | Class assigned to the tooltip close link | | spot-tooltip-content | Class assigned to the tooltip content container |

The JavaScript

$("#pictip-demo").pictip({
    spots: [
        {
            top: '50px',
            left: '20px',
            content: 'Hello!',
            tooltipPosition:'br' //bottom-right
        }
    ]
});

The complete set of options:

| Option | Description | | -------------------------------------------------------- |:--------------------------------------------------------------------------------------------------- | | spots [ Array: [] ] | Spots object array. Refer to the next table for more information. | | spotClass [ String: '.spot' ] | Spots class. | | spotTemplate [ String: '' ] | HTML template to create the spots. | | eventType [ String: 'click' ] | Event type to trigger the tooltip/caption display action (posible values are click and mouseenter). | | tooltip [ Boolean: true ] | Display tooltip or caption? (use caption for a better mobile experience). | | show [ Function: function (tooltip) {} ] | Function that overrides the plugin default show functionality. | | close [ Function: function (tooltip) {} ] | Function that overrides the plugin default close functionality. | | onShowToolTip [ Function: function (spot, tooltip) {} ] | Function executed after the tooltip has opened | | onCloseToolTip [ Function: function (spot, tooltip) {} ] | Function executed after the tooltip has closed |

Functions onShowToolTip and onCloseToolTip are not executed if show and close functions are defined.

Spots set of options:

| Option | Description | | ------------------------------- |:------------------------------------------------------------------- | | top [ Number: 0 ] | Spot top position | | left [ Number: 0 ] | Spot left position | | content [ String: '' ] | Tooltip content. Add any content type | | tooltipPosition [ String: '' ] | Tooltip position relative to spot. (tl, tr, tc, bl, br, bc, cl, cr) | | tooltipId [ String: '' ] | Tooltip ID | | tooltipCss [ Object: {} ] | CSS styling for the tooltip | | tooltipClose [ Boolean: false ] | Set this to true if you want the tooltip close link | | open [ Boolean: false ] | Set this to true if you want the tooltip to be open on page load |

The API

Accessing the PicTip instance.

// You can access the instance with:
var pictip = $("#pictip-demo").data('pictip');

You can access the following methods of the instance:

| Method | Description | | --------------------------------------------- |:------------------------------ | | init [ Function: function (options) {...} ] | Initialize the plugin instance | | closeToolTips [ Function: function () {...} ] | Close all open tooltips | | destroy [ Function: function () {...} ] | Destroy the plugin instance |

Changelog

v0.3.0

  • Adding CSS transitions/animations support (through the new show and close configuration options)
  • Adding position class to tooltip elements in order to describe the tooltip position (relative to spot)

v1.0.0

  • Adding performance improvements for responsive sites

v1.1.0

  • Adding "open by default" option

Contributing

If you'd like to contribute to this project, create a branch and send a pull request for that branch. Hint and test your code.

Any problems, please, let me know.

License

Copyright (c) 2015 Daniel Fernández A. Dual licensed under the MIT and GPL licenses.