Page 1 of 1

html tooltip over images

Posted: Wed Jun 26, 2013 11:45 pm
by nirkedar
How do I place a tooltip over an image.
For example, say I wanted the token name to show when I hover over the token image in the Chat window. How would the code for it look like?

TIA.

Re: html tooltip over images

Posted: Thu Jun 27, 2013 12:46 am
by Full Bleed
nirkedar wrote:How do I place a tooltip over an image.
For example, say I wanted the token name to show when I hover over the token image in the Chat window. How would the code for it look like?

TIA.
You should be able to wrap the image in <span title="tool tip text"></span>.

If you're using broadcast, you'll have to convert the double quotes to single quotes.

Re: html tooltip over images

Posted: Thu Jun 27, 2013 1:29 am
by nirkedar
The image shows (no prob), but the tooltip is still not showing.
What am I doing wrong?

CODE
[H: TokenID = ARG(0)]
[H: TokenName = getName(TokenID)]
[H: switchToken(TokenID)]
[H: ImageFile = strformat('<img border=0 src="%s" />', getTokenImage(60))]

<td style="padding:2px 2px; " align="center" width="100%"><span title='[R: TokenName]'>[R: ImageFile]</span></td>

Re: html tooltip over images

Posted: Thu Jun 27, 2013 2:14 am
by aliasmask
Just going by memory, but for image tooltips, you may have to use the "alt" entity of the <img> tag rather than using <span> which is good for text. I just check some old code and yeah, that's what I did.

Code: Select all

      [H: output = strformat('
         <table cellpadding="0">
            <tr>
               <td width="40" style="padding-right: 5px" valign="top"><img src="%{tokenImage}-40" alt="%{playerName}" /></td>
               <td style="margin-right: 5px; font-weight:700; " valign="top">%{tokenName}:</td>
               <td valign="top"><span>%{chatText}</span></td>
            </tr>
         </table>')]
 

Re: html tooltip over images

Posted: Thu Jun 27, 2013 5:57 am
by nirkedar
That did it for me.
Thanks a mil. 8)