Nov 4, 2012

jQuery TipTip

Have you ever used this jQuery plugin? It is very useful to display info text about your inputs, texts, images, etc. and it has a very nice layout. However there was a little bug in the plugin - it appears in the wrong place if you use css margins. The plugin use the outerWidth() function to show the tiptip in the right place. 
For more details visit this link: http://api.jquery.com/outerWidth/


All you have to do is to open the jquery.tiptip.js file and look around the line 108 you will find something like this:
var org_width = parseInt(org_elem.outerWidth());
var org_height = parseInt(org_elem.outerHeight());
var tip_w = tiptip_holder.outerWidth();
var tip_h = tiptip_holder.outerHeight();
var org_height = parseInt(org_elem.outerHeight(true));
var tip_w = tiptip_holder.outerWidth(true);
var tip_h = tiptip_holder.outerHeight(true);


The outerHeight function does not include the margins in calculation by default, so you have to use outerHeight(true);
Replace the code with this:
var org_width = parseInt(org_elem.outerWidth(true));
And that's it!

No comments:

Post a Comment