Link to home
Start Free TrialLog in
Avatar of ticallian
ticallian

asked on

Javascript: JQuery tooltip plugin - Multiple tooltips using one set of parameters

I'm using the Tooltip plugin for JQuery from www.bassistance.de, although i think the question just needs some javascript to be rearranged to fix my problem

I have multiple (about 15) image tooltips that are attached to a series of HTML labels.

All the tooltips use the same plugin parameters:
      track: true,
      delay: 0,
      showURL: false,
      showBody: " - ",
      fixPNG: true,
      left: 30,
      top: -100,

Its only the "extraClass:" used to style and select which image is displayed that differs.

How can i reduce code by stating the tooltip parameters just once for all tooltips, and then change the extraClass per tooltip?
So the final code looks something like this:

$(function() {
$('.tooltip01, .tooltip02, .tooltip03').tooltip({
      track: true,
      delay: 0,
      showURL: false,
      showBody: " - ",
      fixPNG: true,
      left: 30,
      top: -100
});
$('.tooltip01').tooltip({       extraClass: "tooltip01_css" });
$('.tooltip02').tooltip({       extraClass: "tooltip02_css" });
$('.tooltip03').tooltip({       extraClass: "tooltip03_css" });
});

Thanks for any help

ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ticallian
ticallian

ASKER

Works perfectly, many thanks!