简体   繁体   English

jQuery工具提示不起作用

[英]jQuery tooltip is not working

I want a tooltip to show when I rollover on particular links. 当我将鼠标悬停在特定链接上时,我希望显示工具提示。 It's not working. 没用 The commented out alert is working, so event is not the issue. 已注释掉的警报正在运行,因此事件不是问题。 This is my javascript code: 这是我的JavaScript代码:

$(window).load( function() {

$("a").each(function() {
    if(this.text==" View image") {

        $(this).mouseover(function() {
//              alert("blabla");
            $(this).tooltip();
        });

    }

});

}); });

on my html file the includes are: 在我的html文件中,包括:

<script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" language="javascript" src="jquery.tooltip.min.js"></script>
<script type="text/javascript" language="javascript" src="mainscript.js"></script>

I'd appreciate some help. 我将不胜感激。

UPDATE: removing mouseover doesn't help 更新:删除鼠标悬停无济于事

Remove the mouseover function. 删除鼠标悬停功能。 The plugin doesn't require you to add a custom mouseover function. 该插件不需要您添加自定义鼠标悬停功能。 It's done from the plugin for you. 它是由插件完成的。

if(this.text==" View image") {
            $(this).tooltip();
    }

Hope this helps ^^ 希望这可以帮助^^

Change the main jQuery function to $(document).ready(function(){}); 将主要的jQuery函数更改为$(document).ready(function(){});

This will probably work now~ 现在大概可以了〜

Try this: 尝试这个:

$("a").each(function() {
    if(this.innerHTML == " View image") {
        $(this).tooltip();
    }
}

Also, there's a space before the View in "View image". 此外,“视图图像”中的视图之前还有一个空格。 I'm not sure if that's intentional or not. 我不确定这是否是故意的。

I used jQuery tipsy on my recent projects. 我在最近的项目中使用了jQuery tipy Quite easy to understand and integrate. 非常易于理解和集成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM