2014-07-09 117 views
0

我試圖用這個工具提示: http://osvaldas.info/elegant-css-and-jquery-tooltip-responsive-mobile-friendly爲什麼這個jQuery工具提示不起作用?

下面是測試頁面(在WooCommerce/WordPress的運行): https://blendbee.com/shop/uncategorized/test-product-2/

您可以看到「成分」下的「加載項」有下劃線。如果您將鼠標放在它上面,則會顯示標題,但jQuery工具提示不會顯示。對於「成分」的HTML是:

<abbr title="Here's some info about this ingredient..." rel="tooltip">ingredient</abbr> 

在Chrome中檢查我看到錯誤:

Uncaught TypeError: undefined is not a function

我認爲它在頁腳區域的JS功能做的,我是從拷貝工具提示頁面,但我不知道如何解決它。

$(function(){ var targets = $('[rel~=tooltip]')... 

任何想法?

+0

你試圖把你從工具提示頁面的頭部部分得到了JS? – V31

+1

@ V31 - 不會,因爲劇本作者說身體更好。不用擔心,下面的答案解決了它。 – Kane

回答

1

我在控制檯 中看到$ is not a function,但它看起來像包含jQuery。

嘗試改變

$(function(){...}); 

(function($) { 
     $(function(){...}); 
    })(jQuery);