【问题标题】:How to add tooltip text in js generated buttons?如何在 js 生成的按钮中添加工具提示文本?
【发布时间】:2016-06-08 02:31:46
【问题描述】:

我想向浮动操作按钮中的按钮添加工具提示文本 在这里。

Sample JSFIDDLE

[{
    url: null,
    bgcolor: "red",
    icon: "+"
}, {
    url: "http://www.example.com",
    bgcolor: "orange",
    icon: "+"
}, {
    url: "http://www.example.com",
    bgcolor: "yellow",
    icon: "+"
}]

【问题讨论】:

标签: javascript jquery material-design floating-action-button


【解决方案1】:

您使用的不是最新(和工作)版本。尝试从 GitHub 下载 ZIP(我下载了 1d976c3 并且它有效)并在浏览器中打开 index.html。它只需要一个title 属性

var links = [
  {
    "bgcolor":"red",
    "icon":"+",
    "title": "Click me"
  },
  {
    "url":"http://www.example.com",
    "bgcolor":"red",
    "color":"#fffff",
    "icon":"<i class='fa fa-phone'></i>",
    "target":"_blank",
    "title": "Hey, Click me ..." // <--- This one
  },
  {
    "url":"http://www.example.com",
    "bgcolor":"black",
    "color":"white",
    "icon":"<i class='fa fa-music'></i>",
    "title":"Hey again, Click!" // <--- This one
  }
]

$('.kc_fab_wrapper').kc_fab(links);

【讨论】:

  • 谢谢,答案有帮助。
【解决方案2】:

要添加tooltip,请使用 HTML 属性 - title,如下所示:

<div class="kc_fab_wrapper" title="Add new item"></div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-16
    • 2022-07-05
    • 1970-01-01
    • 2020-10-24
    • 2017-02-28
    相关资源
    最近更新 更多