Poshy Tip - jQuery Plugin for Stylish Tooltips

I almost hear you asking - why another jQuery tooltip plugin? Well, I actually never planned creating this plugin until I reached the final stages of designing this website and decided to add some pretty tooltips. So I started looking for a tooltip plugin that allows easily creating stylish tooltips and also includes the most useful features for such a script. However, I wasn't pleased with the results I found so I ended up writing a completely new plugin and am now making it available for all.

Demos

You might be eager to take a look at some examples so here is the demo page right away. And below you will find a short introduction.

Notable Features

OK, so apart from the awful name, is there anything interesting about this tooltip plugin?

A Single Background Image for Scalable Tooltips

Suppose you need to code a scalable tooltip that looks like this (i.e. a tooltip with auto width/height based on the content inside it):

A figure showing a tooltip mockup that should be used to create a scalable tooltip on the page

The Usual Approach

To achieve this with most similar plugins out there you would need to slice the image into multiple separate images - for the corners of the box, for the sides, etc.:

A figure showing how you would normally need to slice the mockup into 9 images in order to code a scalable tooltip

The Poshy Tip Approach

But since the tooltips only work when JavaScript is enabled anyway, why not apply some JS magic which would make our life easier and save our server some additional requests? This is exactly what Poshy Tip was designed to do. With this plugin, you can create a scalable tooltip by just using a single background image for the tooltip body:

With Poshy Tip you need just 2 images - one for the tooltip body + 1 for the arrow

You need to create one big image for the tooltip body - e.g. something like 1024x768 pixels (which should be enough for anything you may want to display inside a tooltip in the browser viewport). You then have to set it as a background image for the tooltip container DIV in the most trivial way:

.tip-yellow {
	...
	background-image: url(tip-yellow.png);
}

Poshy Tip detects when a background image has been set for the tooltip container DIV and creates a scalable frame from it that wraps the inner contents of the tip. Finally, you just need to specify what should be the size of the background image frame around the inner content by setting the following option:

bgImageFrameSize: 10 // pixels

And the result:

A figure showing the scalable frame created from the background image that wraps the inner DIV

You can, of course, tweak the margin/padding of the inner DIV if needed.

Advanced Positioning Options

With Poshy Tip you can position the tips relative to the mouse cursor or to the target element and align them in every possible way horizontally and vertically (note the alignTo, alignX and alignY options). In addition the script makes sure the tips are always displayed in the browser viewport and also automatically positions the arrow (if available) on the appropriate side of the tooltip body.

Asynchronous Loading of the Tooltip Content

Poshy Tip supports using a function for returning the tooltip content and the script also passes an update callback function as an argument to this function. By using this callback, you can easily update asynchronously the content of the tooltip after it has been displayed. You can see a quick example on the demo page.

Documentation

You can find usage examples and a list of the options and methods available on the demo page.

License

Like jQuery, Poshy Tip is dual licensed under the MIT and GPL licenses.

Git

The Poshy Tip source code is also available at GitHub:

git clone git://github.com/vadikom/poshytip.git

Liked this post?

Don't wait & subscribe to RSS or email updates now.
Quick Tip: Sharing is also easy with the share menu below. :)

Comments:

  • admin

    @Nate Fixed it. Thanks!

    #116 by: Vasil Dinkov on May 14, 2013 at 16:36
  • Thanks for the great plugin!

    Just FYI, the download link on the demo page still points to version 1.1. Any chance you could update it?

    I used it by accident and was stuck on a bug that you already fixed in v1.2 :)

    #115 by: Nate on May 13, 2013 at 20:25
  • admin

    @Parvez

    Hmm, I guess I have only tested with "showTimeout: 0" and I haven't noticed the issue. I will check this at first chance..

    #114 by: Vasil Dinkov on May 13, 2013 at 14:28
  • This is a very practical tooltip ! Thanks

    #113 by: betty on May 13, 2013 at 12:30
  • Hey,

    I was able to fixed it by setting "showTimeout" to 0 (zero).

    :)

    #112 by: Parvez Pathan on May 8, 2013 at 15:18
  • Hi Vasil,

    I worked with the tooltip plugin a little more and observed that the first time when I click the dropdown... the tooltip shows up and gets the focus, as a result the dropdown closes.

    But now after taking the updated scripts, this happens just once (first time I click the dropdown).

    So now the issue is just with the first time click of dropdown (again with Internet Explorer only).

    Could you please help me out on this.

    Thanks a lot already :)

    Parvez

    #111 by: Parvez Pathan on May 8, 2013 at 15:05
  • Thanks a lot. Looks great now :)

    #110 by: Parvez Pathan on May 7, 2013 at 15:29
  • admin

    @Parvez Pathan, @Rick

    Now fixed in v1.2. Please just download the new version.

    #109 by: Vasil Dinkov on May 4, 2013 at 12:16
  • tip does not work well with dropdowns in IE 10. I am unable to select the dropdown values.

    I am showing tips on FOCUS event of all form elements.

    #108 by: Parvez Pathan on April 29, 2013 at 12:41
  • Vasil,
    This is a wonderful tooltip. Do you know if this is going to be working with jQuery 1.9.1 any time soon? On first test, it doesn't seem to be (jQ 1.7.2 is working, not thereafter). Just FYI / curious if you'd investigated this yet.

    Thanks,
    Rick

    #107 by: Rick on April 26, 2013 at 22:01
  • If your poshy tip is not displaying the content in IE9,i.e, only the border of the tip is shown with an empty box, then one fix is to remove the Helvetica font from the CSS

    #106 by: menuFixit on April 3, 2013 at 06:55
  • Hi.
    Will this library can be used as commercial purposes?
    Need to pay to use it?
    Thanks

    #105 by: Linda on January 28, 2013 at 12:45
  • Can i make this slider to be auto slider?

    #104 by: Milan on January 22, 2013 at 03:13
  • Bonito Plugin, pero no trabaja con un Modal Pop Up, me pueden ayudar por favor.

    Problema:
    En un Modal el tooltip, se muestra atras del modal y no es posible verlo.

    Nince Plugin, but don´t work in modal pop up, can you help me please.

    Issue:
    In Modal PopUp the tooltip show it back of modal.

    Thanks

    #103 by: Aarón on November 23, 2012 at 20:30
  • Hi. Nice plugin. But isn't it working on IE -7/8/9????
    Please help me out. Thanks

    #102 by: shyama on November 23, 2012 at 14:46
  • Hey, thanks for this plug-in. Although it took me a while to get working as I wanted, I blame my newbieness and not the software! Can anyone confirm if Poshy Tip is compatible with images and links as content? I don't think you can use either within 'title=', am I right? Was hoping hovering over a Facebook icon could display a "Send Friend Request" image hyperlink, as an example.

    #101 by: Darren Barklie on October 4, 2012 at 00:41

Post a Comment: