在文档就绪时显示提示提示

时间:2012-09-10 14:38:47

标签: jquery tiptip

我正在使用Drew Wilsons Tip Tip Plugin和修改后的方法来“显示”,“隐藏”或“摧毁”TipTip ......

出于某种原因,我无法将所有工具提示显示在准备就绪的文档上,但它们不会出现我想知道是否有人可以引导我朝着正确的方向......这是我的代码......

jQuery的:

jQuery(document).ready(function($) {
$(".botpage a").tipTip({ content: "This is an anchor tag!"});
$(".botpage a").tipTip('show');
});

TipTip默认值

var defaults = {
        activation: "hover", // How to show (and hide) the tooltip. Can be: hover, focus, click and manual.
        keepAlive: false, // When true the tooltip won't disapper when the mouse moves away from the element. Instead it will be hidden when it leaves the tooltip.
        maxWidth: "200px", // The max-width to set on the tooltip. You may also use the option cssClass to set this.
        edgeOffset: 6, // The offset between the tooltip arrow edge and the element that has the tooltip.
        defaultPosition: "bottom", // The position of the tooltip. Can be: top, right, bottom and left.
        delay: 400, // The delay in msec to show a tooltip.
        fadeIn: 200, // The length in msec of the fade in.
        fadeOut: 200, // The length in msec of the fade out.
        attribute: "title", // The attribute to fetch the tooltip text if the option content is false.
        content: false, // HTML or String or Function (that returns HTML or String) to fill TipTIp with
        enter: function () { }, // Callback function before a tooltip is shown.
        afterEnter: function () { }, // Callback function after a tooltip is shown.
        exit: function () { }, // Callback function before a tooltip is hidden.
        afterExit: function () { }, // Callback function after a tooltip is hidden.
        cssClass: '' // CSS class that will be applied on the tooltip before showing only for this instance of tooltip.
    };

HTML

<div class="botpage">
<a>TOOLTIP YAY!</a>
</div>

我做错了什么???如果您需要任何其他代码,请告诉我们!

1 个答案:

答案 0 :(得分:0)

啊哈哈。我看到了这个问题。它显示了一个工具提示。但它只显示一个。看起来插件可能只允许您一次显示一个。看到这个更新的小提琴:jsfiddle.net/ygswQ/1。因此,您可能需要修改源代码或使用其他工具提示插件来执行此操作。

有一个的jQuery工具提示插件。我认为最流行的一个是qtip。以下是如何在qTip中执行此操作的示例:http://jsfiddle.net/GEycz/