尝试使用jquery工具提示插件时,对象没有方法"tooltip"; [英] trying to use jquery tooltip plugin, object has no method "tooltip"

查看:122
本文介绍了尝试使用jquery工具提示插件时,对象没有方法"tooltip";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下工具提示: http://flowplayer.org/tools/demos /tooltip/index.html

I'm using this tooltip: http://flowplayer.org/tools/demos/tooltip/index.html

我的html文件中包含以下几行:

I have the following lines in my html file:

<script src="/javascripts/home.js" type="text/javascript"></script>
<script src="http://cdn.jquerytools.org/1.2.6/jquery.tools.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/scripts/jquery.min.js"></script>

<div id="boo">
<img src="image1.jpg" title="this thing is a tool"/>
<img src="image2.jpg" title="this thing is also tool"/>
</div>

我的home.js文件中包含以下行:

I have the following line in my home.js file:

$("#boo img[title]").tooltip();

我的css文件中包含以下行:

I have the following line in my css file:

.tooltip {
    display:none;
    background:transparent url(/tools/img/tooltip/black_arrow.png);
    font-size:12px;
    height:70px;
    width:160px;
    padding:25px;
    color:#fff; 
}

我收到此错误:

Uncaught TypeError: Object [object Object] has no method 'tooltip'

我机智.我觉得我已经完全按照网站上的示例进行操作了,但是不知道发生了什么.

I'm at my wits end. I feel like I've followed the example on the site exactly, but no idea what's going on.

推荐答案

您应该重新排列js文件的顺序:

You should reorder your js files:

<script type="text/javascript" src="/scripts/jquery.min.js"></script>
<script src="http://cdn.jquerytools.org/1.2.6/jquery.tools.min.js" type="text/javascript"></script>
<script src="/javascripts/home.js" type="text/javascript"></script>

对其他任何有此问题的人进行一些解释:

A little more explanation for anyone else having this problem:

脚本按调用顺序加载,因此您要先加载jQuery,然后再加载任何插件,然后再加载自定义代码.

Scripts are loaded in the order they're called, so you want to load jQuery first, then any plugins, then your custom code.

这篇关于尝试使用jquery工具提示插件时,对象没有方法"tooltip";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆