Hi,

I use the following function in my Tipsy, however the output text is "undefined". please help me!

Thanks,
Kourosh

CommentFileSizeAuthor
#15 2-13-2013 5-15-03 PM.png2.59 KBNAGARAJ
Capture.JPG11.23 KBkourosh.a
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kourosh.a’s picture

this is the function is use:
function() { return 'My content'; }

Mohammed J. Razem’s picture

Assigned: Unassigned » Mohammed J. Razem
Category: support » bug
Status: Active » Postponed

This is caused by eval() function inside the Tipsy-Drupal JS wrapper.

A quick fix for this, is to implement the Tipsy tooltip for your rule inside a JS file in your theme or module, instead of defining it from the admin UI.

Example:

$('.my-selector, #my-other-selector').tipsy({
  gravity: 'w', // Or any preferred setting, see http://onehackoranother.com/projects/jquery/tipsy/#options
  title: function() {return 'My content';}
});
kourosh.a’s picture

Hi,
Thanks for your reply. I just tried that. But no luck! I can't get it work. Nothing appears...

Michsk’s picture

If we need to create custom js we don't need this module... subscribing

Traphic’s picture

I have the same problem with all custom tooltips, apart from the forms. It kind of defeats the object to add code to a js file.

I got it working by using 'title' (without quotes) in the 'Tooltip content:' box in Tipsy UI, and using title="custom content" as an html attribute where I want the tooltip to display, but I would rather manage it all in the admin panel and use html content instead of simple text.

Is there a fix that can be applied to the module?

Michsk’s picture

I can't get this running. Is there anyone who can help me out?

	$('.ref-usr').tipsy({
  	  gravity: 's',
	  html: true,
	  title: function() {return $(this).find('.ref-info').html();}
	});

So i have a view which returns some avatars, and the name. The usrname is in .ref-info. Now when we hover over li.ref-user i want to show ref-info in the tooltip.

Michsk’s picture

Doesn't do it either:

$('.ref-usr').tipsy({
  	  gravity: 's',
	  html: true,
	  title: function() {return 'test';}
	});

And yes this code is in a custom .js file and not trough the admin UI.

muschpusch’s picture

@Mohammed J. Razem: the module is kind of useless at the moment could you explain a little more why you think that it doesn't work maybe i can provide a patch....

Michsk’s picture

Patches are always welcome, for now i must say i just dropped the module and downloaded the tooltip script and call it trough a own .js file. Just like described here.

techninja’s picture

If anyone is coming from views_tooltip with this problem, make sure and go back to the tipsy settings page and change the title selector to child (not attribute) and make sure it's ".tooltip-content" with a period at the beggining.

boabjohn’s picture

Hey @techninja: you're a champion!

NAGARAJ’s picture

i couldn't get it please help me

boabjohn’s picture

@nagaraj : On the tipsy setting spage there is a form element where you can enter a css selector name.
It is easy to forget to add the "." at the beginning of the class name...so make sure it reads:
.tooltip-content
Does that help? If not, please explain more about where you are getting confused.
Cheers.

NAGARAJ’s picture

Thank you.. boabjohn for asking..
I am beginner and my problem is i got the tipsy tool tip in the drupal forms and while i create a css selectors such as .tooltip-content and add html attribute such as

function() { return 'My custom tooltip content'; }
</script>

but when i using the page

 < a class="tooltip-content"> example </a>

it shows undefined... Please help... me..

NAGARAJ’s picture

FileSize
2.59 KB
boabjohn’s picture

Hi @nagaraj,
I have not looked at this in awhile, but maybe try this:
1. Remove your custom 'tooltip-content' style definition from your css/theme
2. Flush theme cache and reload page
3. Check the markup on the page with FireBug...see if there is a class definition already
This would be provided by the Tipsy module.
Maybe the current problem is that you're confusing the set-up by creating your own class?

NAGARAJ’s picture

Thank you boabjohn i got it work now......thank you very much

francula’s picture

Hi,
i did all described steps but still. I got the undefinde tooltip.
When i check the element with firebug there is no class definition there.
What can i do.
Regards

kasalla’s picture

Not sure, but I think, the element to display in a tooltip has to be wrapped by the "Hover"-selector.

Like this which worked for me:

<div class="views-tooltip">
   Hover me
   <div class="tooltip-contents">
      Show me in tooltip
   </div>
</div>

Following code didn´t work:

<div class="views-tooltip">Hover me</div>
<div class="tooltip-contents">Show me in tooltip</div>

I don´t know, if this is a bug.