Clean & Flexible Tooltip Plugin For jQuery - Tooltipster

Clean & Flexible Tooltip Plugin For jQuery - Tooltipster
File Size: 87.3 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Tooltipster is a clean and  lightweight jQuery Tooltip Plugin for creating extremely flexible, HTML5 validated tooltips.

Installation:

# NPM
$ npm install tooltipster

# Bower
$ bower install tooltipster

Usage:

1. Include necessary elements in your head section.

 <link rel="stylesheet" href="css/tooltipster.css" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="js/tooltipster.bundle.min.js"></script>

2. Call the plugin with default options.

$(document).ready(function() {
  $('.tooltip').tooltipster();
});

3. The Markup.

<a href="https://www.jqueryscript.net" class="ketchup tooltip" title="Providing tons of Jquery Plugins , Html5 and CSS3 Scripts for web developers!">jQueryScript.Net</a>

4. Options and defaults.

// fade, grow, swing, slide, fall
animation: 'fade',

// Sets the duration of the animation, in milliseconds. 
// If you wish to provide different durations for the opening and closing animations, provide an array of two different values.
animationDuration: 350,

// If set, this will override the content of the tooltip.
content: null,

// If the content of the tooltip is provided as a string, 
// it is displayed as plain text by default. 
contentAsHTML: false,

// If you provide a jQuery object to the 'content' option, 
// this sets if it is a clone of this object that should actually be used.
contentCloning: true,

// Debug mode
debug: true,

// Delay how long it takes (in milliseconds) for the tooltip to start animating in.
delay: 200,

// Upon touch interaction, this is the delay before the tooltip starts its opening and closing animations when the 'hover' trigger is used (*). 
// If you wish to specify different delays for opening and closing, you may provide an array of two different values.
delayTouch: [300, 500],

// fired only once at instantiation
functionInit: null

// fired before the tooltip opens
functionBefore: null

// fired when the tooltip and its contents have been added to the DOM.
functionReady: null

// fired once the tooltip has been closed and removed from the DOM. 
functionAfter: null

// A custom function that does not modify the content but that can format it for display. 
// It gets the two first usual arguments and also the content as third argument. 
// It must return the value that will be displayed in the tooltip, either a string or a jQuery-wrapped HTML element. 
functionFormat: null,

// The minimum version of Internet Explorer to run on. 
IEmin: 6,

// Give users the possibility to interact with the tooltip. 
interactive: false,

// Allows you to put multiple tooltips on a single element. 
multiple: false,

// will default to document.body, or must be an element positioned at (0, 0)
// in the document, typically like the very top views of an app.
parent: 'body',

// The names of plugins to be used by Tooltipster.
plugins: ['sideTip'],

// Repositions the tooltip if it goes out of the viewport when the user scrolls the page, in order to keep it visible as long as possible. 
repositionOnScroll: false,

// Specifies if a TITLE attribute should be restored on the HTML element after a call to the 'destroy' method. 
// This attribute may be omitted, or be restored with the value that existed before Tooltipster was initialized, or be restored with the stringified value of the current content. 
// Note: in case of multiple tooltips on a single element, only the last destroyed tooltip may trigger a restoration.
restoration: 'none',

// Sets if the tooltip should self-destruct after a few seconds when its origin is removed from the DOM. 
// This prevents memory leaks. 
selfDestruction: true,

// Set a theme that will override the default tooltip appearance. 
// You may provide an array of strings to apply several themes at once (see the themes section).
// Default, Light, Borderless, Punk, Noir, Shadow
theme: [],

// How long (in ms) the tooltip should live before closing. 
timer: 0,

// Sets how often the tracker should run (see trackOrigin and trackTooltip), in milliseconds. 
// The tracker runs even if trackOrigin and trackTooltip are false to check if the origin has not been removed while the tooltip was open, so you shouldn't set too high or too low values unless you need to. 
trackerInterval: 500,

// Repositions the tooltip if the origin moves or is resized. As this option may have an impact on performance, we suggest you enable it only if you need to. 
trackOrigin: false,

// Repositions the tooltip if its size changes. 
// When the size change results from a call to the 'content' method, the tooltip is already repositioned without the need to enable this option. 
// As this option may have an impact on performance, we suggest you enable it only if you need to. 
trackTooltip: false,

// Sets when the tooltip should open and close. 'hover' and 'click' correspond to predefined sets of built-in triggers, while 'custom' lets you create your own, for a completely customized behavior. 
// click, mouseenter, touchstart, tap, click, mouseleave, originClick, scroll, tap, touchleave
trigger: 'hover',

triggerClose: {
  click: false,
  mouseleave: false,
  originClick: false,
  scroll: false,
  tap: false,
  touchleave: false
},
triggerOpen: {
  click: false,
  mouseenter: false,
  tap: false,
  touchstart: false
},

// Plays a subtle animation when the content of the tooltip is updated (if the tooltip is open). 
// You may create custom animations in your CSS files. 
// Set to null to disable the animation.
updateAnimation: 'rotate',

// Set the z-index of the tooltip. 
zIndex: 9999999

Change Logs:

2018-01-30

  • v4.2.6

2017-04-29

  • Fixed: Cannot read property 'trigger' of null

2017-03-22

  • v4.2.3

2017-03-05

  • loop fix

2017-03-04

  • use closing animation upon self destruction

2017-01-22

  • Fixed: Fails on reading `tagName` of `undefined`.

2016-10-20

  • stop repositioning upon the opening of virtual keyboards

2016-09-23

  • Fixed Tooltipster dimensions

2016-08-20

  • Fixed for IE

2016-07-18

  • Added the data-tooltip-content attribute

2016-07-09

  • iOS8+ fix

2016-06-22

  • SVG fixes

2016-06-14

  • update

v3.3.0 (2014-11-12)

  • Added closeOnClick and positionTrackerCallback options
  • Added the restoration method

v3.2.4 (2014-05-15)

  • give the option method a setter capability

v3.2.3 (2014-05-02)

  • Removed fixedWidth, added minWidth

v3.2.1 (2014-04-07)

  • Logging a warning instead of throwing an error when initiating a non-multiple tooltip on an element that already has one

v3.2.1 (2014-04-05)

  • Adapted the onlyOne option to work fine with the multiple option

v3.2.0 (2014-04-05)

  • Implemented the 'multiple' option

v3.1.4 (2014-03-20)

  • update

v3.1.3 (2014-03-20)

  • fixed vertical positioning on area targets

v3.1.2 (2014-03-18)

  • Added a callback parameter to show and hide API methods

v3.1.0 (2014-02-25)

  • Added a callback parameter to show and hide API methods

v3.0.5 (2014-01-27)

  • Wrong offset bug fix

v3.0.2 (2014-01-14)

  • Wrong offset bug fix

v3.0.1 (2014-01-10)

  • version update

v3.0.0 (2013-12-31)

  • Prevent onlyOne from closing non-autoclosing tooltips. 

v2.2.3 (2013-10-31)

  • Fixed functionInit and broken minified version.

v2.2.2 (2013-6-01)

  • Fixing various bugs and confirming fix for select elements inside tooltips

v2.1.4 (2013-6-01)

  • Smarter detection between non-touch/touch devicesC
  • ontent option can now accept jQuery objects
  • Content update method now works on icons

v2.1.3 (2013-2-13)

  • Refining and testing disable/enable API methods

This awesome jQuery plugin is developed by iamceege. For more Advanced Usages, please check the demo page or visit the official website.