【问题标题】:jQuery tooltip random appearjQuery tooltip 随机出现
【发布时间】:2015-06-18 12:01:22
【问题描述】:

我正在开发这种“标志颜色”。单击后,我需要工具提示出现在 id 为 #show 的 DIV 中(这没关系)。但是在悬停按钮后,工具提示会出现在它想要的任何地方。

在这里访问我的问题:http://web-stranky.org/pro_dementa/

$(document).ready(function () {
    $( document ).tooltip( {
        content:  function() {
            return  $( this ).attr( "title" );
        }
    });      
    $('button').click(function(){
        $('#show').html($('#' + $(this).attr('aria-describedby')).children().html());
    });
});

【问题讨论】:

  • 我看到您包含了 2 个 jquery 文件,其中一个版本为 1.11.3,另一个版本为 1.6.2,这会导致控制台错误 .on('click' is not a function。请注意这一点!!并且你必须只保留一个版本的jquery,如果你使用最新版本会很好
  • 对不起旧版本。现在是实际的。谢谢你的意见。
  • 所以你使用的是旧版本?
  • "function" -on('click'.. 没问题。这行是为了改变颜色。我只需要在一个 div 中显示每个按钮的标题 :) 谢谢

标签: jquery random tooltip delay show


【解决方案1】:

您还没有包含jquery-ui.css。只需将其添加到文档中,一切都会好起来的!

您可以从 here

获得它

更新

如果您在 div 中需要它以及 html 添加 title 属性,如下所示从其他元素中删除 title 属性

$('#show').html($('#' + $(this).attr('aria-describedby')).children().html());

$('#show').attr('title',$('#' + $(this).attr('aria-describedby')).children().html()); //add this

【讨论】:

  • 仍然无法正常工作。将带有 title="" 的按钮悬停后的问题
  • 你现在已经包含了两次 jquery-ui.js 而不是 jquery-ui.css
  • 现在它的工作..谢谢.. 但我仍然在光标附近有标题...我只需要它在 id 的 div
    #show
  • @ErikMargony 更新了答案!!检查它并告诉我,如果这对您有帮助,请不要忘记将其标记为答案,以便将来其他人发现这篇文章很有用!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-07-20
  • 2015-05-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多