Letractively / tooltips

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

Line break example not working #26

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
1.0

Please provide any additional information below.
The documentation does not show how to have a line break in the tooltips
content. The example given on the website gives an example of a line break
but it does not go to the next line.

Original issue reported on code.google.com by mittipro...@gmail.com on 21 Sep 2008 at 12:58

GoogleCodeExporter commented 8 years ago
I could show some line breaks in an alert() popup after changing the line

this.content = this.el.title;

into the line

this.content = this.el.title.replace(/\\n/g, "\n");
alert(this.content); // Does show the line breaks in the alert() popup

But it still does not show the line breaks into the tooltips.

Original comment by mittipro...@gmail.com on 27 Sep 2008 at 8:25

GoogleCodeExporter commented 8 years ago
Tried several ways my self:

\n
<br />

Nothing seems to work, neither does the example.

Any idea if this will be fixed or what the solultion is? 

Original comment by pokerfor...@gmail.com on 13 May 2009 at 9:28

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hello, (sorry my en english is --)
Thanks for CoolTips !

I try also to display the break line into the tooltips with image elements.
I use version 1.0.
Prototype 1.6.0.2
Firefox 3.0 / IE7 / IE6 (windows)

Tried the solutions :

\n (with PHP)
chr(10) . chr(13)(with PHP)

The code is (as in the examples, with or without charset) :

<div id="carousel_preview_list">
    <img src="images/my.jpg" class="imageweb" title="Comments :
    The first image" />
    ...
</div>

<script type="text/javascript" charset="utf-8">
$$('#carousel_preview_list .imageweb').each(function(preview_img)
{
    new Tooltip(preview_img, {mouseFollow: true,
                backgroundColor: '#FFF8DD',
                borderColor: '#E9750C',
                maxWidth: 350,
                opacity: 0.85
                });
});
</script>

Thanks for your help.
c.e

Original comment by chaki...@gmail.com on 3 Jun 2009 at 4:54

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi, (sorry my en english is always --)

I adopted this solution to display HTML formatting in the title property in the 
tooltip :
In 'appear' method (Building tooltip container)
replace : [this.content]
with : [new Element("span").update(this.content)]
--> Builder.node interpret this.content as text (wating text or HTML element 
parameter)

Tested with :
Tooltip v1.0.
Prototype v1.6.0.2
script.aculo.us builder.js v1.7.0
Firefox 3.0 / IE7 / IE6 (windows)

Work perfectly with this example (the <br /> tag produces a newline) :

<div id="carousel_preview_list">
    <img src="images/my.jpg" class="imageweb" alt ="my.jpg" title="<strong>Comments
:</strong><br />The first image" />
    ...
</div>

<script type="text/javascript" language="javascript">

$$('#carousel_preview_list .imageweb').each(function(preview_img)
{
    new Tooltip(preview_img, {mouseFollow: true,
                backgroundColor: '#FFF8DD',
                borderColor: '#E9750C',
                maxWidth: 350,
                opacity: 0.85
                });
});
</script>

Thanks for all
e.c

Original comment by chaki...@gmail.com on 4 Jun 2009 at 12:28

GoogleCodeExporter commented 8 years ago
same problem here..
one year passed still cant use line brakes ??
also i tried last fix doesnt work

Original comment by jaxx...@gmail.com on 31 Jul 2010 at 6:53

GoogleCodeExporter commented 8 years ago
Fix seemed fine to me. I edited the end of line 111 (end of "var content = ..." 
From: update(this.content);
  To: update(new Element("span").update(this.content));

Original comment by Peter.Bi...@gmail.com on 6 Dec 2010 at 5:23