jquery tipsy plugin. tipsy is not a function
I'm attempting to use the tipsy plugin to display tooltips on my jsp page. I've copied the script and css, and image file into my script, css and image directories and included these in the head of my page.
<script type="text/javascript" src="../scripts/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../scripts/jquery.tipsy.js"></script>
<link rel="stylesheet" href="../_templates/css/tipsy.css" type="text/css" />
I've added a test tool tip
<a id='example-1' href='#' title='Hello World'>Hover over me</a>
I've tried to add the tipsy function to my in both window.load and document ready.
$(window).load(function() {
alert("window load occurred!");
$('#example-1').tipsy();
});
Either way, Firefox, using firebug to debug, I get the error:
$("#example-1").tipsy is not a function
I can use the 'Script' tab in firebug to view the jquery.tipsy.js. So I know the file is being being loaded. IE reports error: 'Object doesn't support this property or method'.
I've tried using the 0.1.7 version of tipsy downloaded from the website.
http://onehackoranother.com/projects/jquery/tipsy/#notes
I also tried the version 1.0.0a version开发者_运维技巧 available for download through github. Both show this same behavior. I've attempted to integrate this on 2 different pages. 1 page uses only jquery, the other page is successfully using other jquery ui widgets and plugins including datepicker, accordion, autocomplete, json2.
Any ideas on what I'm missing? All of the posts and directions I've found for tipsy sound like "all you have to do is ..."
I know it's an old question, but I just had a similar issue with tipsy. Parts of my page are being changed using the jQuery load() function. I am loading pages that use the notation to include tipsy.js. I can also see that firefox is including tipsy in the Net window, but when trying to execute .tipsy() it says "tipsy is not a function". I do wait to call tipsy() on document.ready(), but it still doesn't work for some reason. All of this seems to work without a hitch in Chrome, so just for Firefox I added:
if ($.browser.mozilla)
{
$.getScript("pathtotipsy/tipsy.js", function(data, textStatus, jqxhr) {
$("#foo").tipsy();
console.log('Success tipsy.js loaded !');
});
}
This just loads tipsy again and for some reason now it works. Hopefully someone has a better solution to this.
I would suggest changing $(window).load(...)
to $(document).ready(...)
.
It's possible that that javascript code is trying to be run before the tipsy.js
is loaded. Doing the $(document).ready(..)
would prevent that by not letting .tipsy()
be called until the page is fully loaded.
Just my solution and issue. As I found out later on, the jquery library got loaded two times.
This caused tipsy and other functions not to work, i. e. they were undefined
.
精彩评论