HTML-Tooltip-Javascript

 view release on metacpan or  search on metacpan

lib/HTML/Tooltip/Javascript.pm  view on Meta::CPAN


=over 4

=item javascript_dir

This defines the relative url to the wz_tooltip.js file.  For example, if you have put the wz_tooltip.js file in a 'javascript' directory under your document root, then you would use:

    javascript_dir => '/javascript/'

The default is /.

=item options

The hash of options defines the options available in Walter Zorn's library, but with more user-friendly names.  It also allows the definition of default text for the tooltip box.  The options available are:

    option           javascript option
    -------          ------------------
    above            T_ABOVE
    bgcolor          T_BGCOLOR
    bgimg            T_BGIMG
    borderwidth      T_BORDERWIDTH
    bordercolor      T_BORDERCOLOR
    default_tip      (none)
    delay            T_DELAY
    fix              T_FIX
    fontcolor        T_FONTCOLOR
    fontface         T_FONTFACE
    fontsize         T_FONTSIZE
    fontweight       T_FONTWEIGHT
    function         (none)
    left             T_LEFT
    above            T_ABOVE
    offsetx          T_OFFSETX
    offsety          T_OFFSETY
    padding          T_PADDING
    shadowcolor      T_SHADOWCOLOR
    shadowwidth      T_SHADOWWIDTH
    static           T_STATIC
    sticky           T_STICKY
    title            T_TITLE
    titlecolor       T_TITLECOLOR
    width            T_WIDTH

When defined in new, the options will be applied to each tooltip, unless the call to tooltip() specifically redefines that option.

The default_tip is the text that will be used if no text is provided in the call to tooltip().

The function option is used if the text you pass in as the tip is actually a call to a javascript function.  The javascript function must return text to output in the tooltip.

=head2 tooltip

    my $tip1 = $tt->tooltip("Tip", \%options);

This method returns the HTML to be inserted into the HTML element for which the tooltip is to be displayed.

For example, to output a tooltip for a link:

    my $tip1 = $tt->tooltip("Example Tip", {fontcolor => 'blue'});
    print qq(<a href="/example/" $tip1>Example</a>);

This would output a link with text 'Example', and when the mouse pointer hovers over the link, a popup box with the words 'Example Tip' in blue would appear.

Any options passed into to the tooltip() method will overwrite the values provided in the new method.  However, options provided in the new method will be inherited unless specifically undefined in the tooltip method.

=head2 at_end

    print $tt->at_end;

This method outputs the html to include Walter Zorn's script.  It must be output after all tooltip related output.  We recommend printing the output of this method at the end of the html, just before the close BODY tag (hence the name at_end()).

=head1 BROWSER SUPPORT

Walter Zorn's site states that the library supports the following browsers:

Linux: Konqueror 3, Browsers with Gecko-Engine (Mozilla/Firefox, Netscape 6, Galeon), Netscape 4 and 6, Opera 5 and 6.

Windows: Netscape 4, Gecko Browsers, IE 4, 5.0, 5.5 and 6.0, Opera 5,6,7.

Other: The equivalent browsers on other Operating Systems should also work as expected.

=head1 EXPLANATION OF OPTIONS

These explanations are based on Walter Zorn's own documentation at http://www.walterzorn.com, except for 'default_tip' and 'function' which are perl only options.

=item above

Places the tooltip above the mousepointer. Value: true.  Additionally applying the B<offsety> command allows to set the vertical distance from the mousepointer.

=item bgcolor

Background color of the tooltip.

=item bgimg

Background image.

=item borderwidth

Width of tooltip border. May be 0 to hide the border.

=item bordercolor

Border color.

=item default_tip

Used in the new() method only.  Provides default text to be used in a tooltip when no other text is defined.

=item delay

Tooltip shows up after the specified timeout (milliseconds). A behavior similar to that of OS based tooltips.

=item fix

Fixes the tooltip to the co-ordinates specified within the square brackets. Useful, for example, if combined with the B<sticky> command.

=item fontcolor

Font color.

=item fontface



( run in 2.742 seconds using v1.01-cache-2.11-cpan-364913b4093 )