Download & Extend

Tags for which jtooltips are generated

Project:jTooltips
Version:5.x-1.5
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I'm getting the impression jtooltips are only generated for title attributes of a tags. Is this the case? Because I have some other elements I'd like to display jtooltips for. Would it be possible to make this customizable?

Comments

#1

Category:support request» feature request

It would also be nice to be able to exclude certain CSS classes — because one might not want every title to display as a jtooltip.

#2

There in the setting a text area where you can config the Tooltip (jquery) code:

refere to the Tooltips documentation on the official site:
http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/

#3

If you only want tooltips to show up for certain links, then just edit "Advanced jQuery tooltip configuration" at www.yoursite.com/admin/settings/jtooltips

Whereas initially it says:

if (Drupal.jsEnabled) {
  $(document).ready(function () {
  $('a').Tooltip({
  delay: 0,
  track: true,
  showURL: false,
  showBody: "; "
  });
  });

You'll want to change it to something like:

if (Drupal.jsEnabled) {
  $(document).ready(function () {
  $('a.tooltip').Tooltip({
  delay: 0,
  track: true,
  showURL: false,
  showBody: "; "
  });
  });

So instead of searching for any anchor, it will search for an anchor with the tooltip class.

This is made particularly simple in views, where many field allow you to "Output this field as a link" and gives you control of css classes and alt text. Add the "tooltip" css class and add alt text (which also copies that text into the title attribute). Since you can use replacement variables in this alt field, this opens up a whole range of possibilities for have text from excluded fields incorporated into a tooltip, saving valuable real estate in a cramped table!

Good luck!

#4

Hi , I added class to img and its not working,
what am I doing wrong ?

if (Drupal.jsEnabled) {
$(document).ready(function () {
$('img.imagecache-desmot').Tooltip({
delay: 0,
track: true,
showURL: false,
showBody: "; "
});
});
}

when there is 'img' only everything looks fine but I dont want it to be display over every image on my page.

#5

ummm... that's odd... Can I look at an example? I don't know what to think if you're having problems with the selector, because that's jQuery itself...

#6

sorry , it works, my fault, I checked on the image added by hand to node body with a proper class.
but I have a question by the way...
how to add class to IMG rendered by imagecache ?
when I have a view with images made by image cache, they don't have any class, co I cannot assign jToolTip to them..

#7

ohh, and one more thing I think it could be useful if you write about the module - imagefield_tokens - on your module site or documentation.
it ads lots of new tokens to image title , so they can be used by your module. I was looking for this quite long, how to add title to the IMG automaticaly, using for example node title.

#8

Hi Benone,

You might want to look more into jquery selectors, since they're pretty powerful. Like it your imagecache image is always in one column, and cells in that column are given a specific class, then even if the image itself has no class, you can select it with ">", which is the child selector.

For example

if (Drupal.jsEnabled) {
$(document).ready(function () {
$('column-1 > img').Tooltip({
delay: 0,
track: true,
showURL: false,
showBody: "; "
});
});
}

There also might be a place in views itself where you can manually add a class. Not sure though -- it's been awhile...

Good luck!

#9

thanks for the tip! :)

nobody click here