【问题标题】:Why does this jQuery tooltip not work?为什么这个 jQuery 工具提示不起作用?
【发布时间】:2014-08-31 00:52:56
【问题描述】:

我正在尝试使用此工具提示: http://osvaldas.info/elegant-css-and-jquery-tooltip-responsive-mobile-friendly

这是测试页面(在 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 Inspect 中我看到一个错误:

Uncaught TypeError: undefined is not a function

我认为它与页脚区域中的 JS 函数有关,我从工具提示页面复制了该函数,但我不确定如何修复它。

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

有什么想法吗?

【问题讨论】:

  • 你试过把从tooltip页面得到的js放到head部分吗?
  • @V31 - 不,因为脚本作者说身体更好。不过不用担心,下面的答案已解决。

标签: javascript jquery


【解决方案1】:

我在控制台看到$ is not a function 但是好像包含了 jQuery。

尝试改变

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多