Tippy.js内容出现问题



我直接从tipy.js文档中取了这个例子:

<button id="myButton">My Button</button>
tippy('#myButton', {
content: "I'm a Tippy tooltip!",
});

我似乎无法使content选项发挥作用;但是如果我在button元素中放入title属性,就会出现提示!

按钮上的title属性是HTML按钮元素的默认行为。

你包括剧本了吗?我尝试了下面的方法(正如文档中提到的(,它没有任何问题。

<button id="myButton">My button</button>
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>
<script>
// With the above scripts loaded, you can call `tippy()` with a CSS
// selector and a `content` prop:
tippy('#myButton', {
content: 'My tooltip!',
});
</script>

演示

最新更新