在哪里放置我的js技巧-jQuery Tooltip [英] where to put my js for tipsy - jquery tooltip

查看:58
本文介绍了在哪里放置我的js技巧-jQuery Tooltip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我已经下载了样式表和javascript文件"tipsy.css"和"jquery.tipsy"并将其包含在其中.我添加了图像"tipsy.gif"并修改了它的路径. 我将以下内容放入了application.js

So I've downloaded and included in my stylesheets and javascript files "tipsy.css" and "jquery.tipsy". I added the image "tipsy.gif" and modified it's path. I put in my application.js the following

$(window).load(function () {
   $('#example-1').tipsy();
});    

然后我将这一行放在我的视图中:

And I put this line in my view:

<a id='example-1' href='#' title='Hello World'>Hover over me</a>

当我将鼠标悬停在上方时,没有任何魔法起作用.只有悬停标题上的标准.我在这里做什么错了?

When I hover over it no tipsy magic comes to work. Only the standard on hover title. What am I doing wrong here?

我在Rails上使用ruby,并将其包含在样式表和js中:

I am using ruby on rails and have included this in my stylesheets and js:

<%= stylesheet_link_tag 'application','tipsy'%>
<%= javascript_include_tag "application", "jquery", "jquery.tipsy"%>

我已经尝试了许多操作,包括更改window.load函数和更改元素的类,并进行了大量谷歌搜索,但我只是找不到答案,这是什么地方.

I've tried many things from changing my window.load function and changing classes of my element and done a lot of googling but i just can't find the answer what is wrong here.

任何帮助将不胜感激.

Any help would be greatly appreciated.

推荐答案

更改:

<%= javascript_include_tag "application", "jquery", "jquery.tipsy"%>

收件人:

<%= javascript_include_tag "jquery", "jquery.tipsy", "application" %>

我不了解Ruby和javascript_include_tag,但我假设您在jQuery之前先加载application.js,然后在可用的地方先加载

I don't know Ruby on rails and the javascript_include_tag but I assume you where loading application.js before jQuery and tipsy where available.

这篇关于在哪里放置我的js技巧-jQuery Tooltip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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