Letractively / tooltips

Automatically exported from code.google.com/p/tooltips
0 stars 0 forks source link

should conditionally display tooltip only when title is not empty.... #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I changed your tooltips.js code by adding a conditional like this:

    if(this.content != '')
      this.appearingFX = new Effect.Appear(this.tooltip, {duration:
this.options.appearDuration, to: this.options.opacity });

This conveniently keeps the tooltip hidden when title attribute is empty.

Original issue reported on code.google.com by jerryg...@gmail.com on 30 Oct 2007 at 7:26

GoogleCodeExporter commented 8 years ago
then I realized I also needed this test added to line 50:

      if(this.content != '')
        this.appearingFX.cancel();

to eliminate a JS error which happens when trying to cancel the non-existent 
tooltip.

Original comment by jerryg...@gmail.com on 31 Oct 2007 at 2:59

GoogleCodeExporter commented 8 years ago
I require this as well, annoying that tooltips show when no title defined. Can 
you 
provide the exact line numbers you modified and provide a few lines before and 
afer 
your changes?

Original comment by justink...@gmail.com on 1 Nov 2007 at 3:58

GoogleCodeExporter commented 8 years ago
No problem. I suspect there may be a cleaner way to accomplish this, but I went 
for
the very first thing I saw that would work. Here's the diff for my changes:

50c50,51
<                       this.appearingFX.cancel();
---
>       if(this.content != '')
>                       this.appearingFX.cancel();
96c97,99
<               this.appearingFX = new Effect.Appear(this.tooltip, {duration:
this.options.appearDuration, to: this.options.opacity });
---
>
>     if(this.content != '')
>       this.appearingFX = new Effect.Appear(this.tooltip, {duration:
this.options.appearDuration, to: this.options.opacity });
119c122
< };
\ No newline at end of file
---
> };

Original comment by jerryg...@gmail.com on 1 Nov 2007 at 5:04

GoogleCodeExporter commented 8 years ago
I am sorry, I am tard, but don't follow your changes, can you please just email 
me 
your tooltips.js file?

Send to: kobenews AT cox DOT net

Original comment by justink...@gmail.com on 2 Nov 2007 at 6:02

GoogleCodeExporter commented 8 years ago
jerrygsxr, are you able to e-mail the updated code?

Original comment by justink...@gmail.com on 5 Nov 2007 at 2:57

GoogleCodeExporter commented 8 years ago
Simply add "if(!this.el.title) return; " to initialize method:

// Tooltip Object
var Tooltip = Class.create();
Tooltip.prototype = {
  initialize: function(el, options) {
    this.el = $(el);

    if(!this.el.title) return;

    this.initialized = false;
    this.setOptions(options);
.........

Original comment by ozanha...@gmail.com on 4 Jun 2008 at 8:46