为什么我的Bootstrap popover不起作用? [英] Why does my Bootstrap popover not work?

查看:631
本文介绍了为什么我的Bootstrap popover不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Bootstrap popover 。所以我将示例中的确切代码复制到我的网站中,遗憾的是这不起作用。我粘贴了下面的完整代码并创建了这里的jsfiddle

I'm trying to use the Bootstrap popover. So I copied the exact code from the example into my website, which unfortunately doesn't work. I pasted the full code below and created a jsfiddle here.

我尝试将它放在一个引导容器中,并且在行和列中,但似乎没有任何效果。

I tried putting it in a bootstrap container and in rows and columns, but nothing seems to work.

是否有人如何让这个小提琴起作用?欢迎提供所有提示!

Does anybody how I can get that fiddle to work? All tips are welcome!

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="//code.jquery.com/ui/1.11.2/jquery-ui.min.js"></script>
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</head>
<body>
<button type="button" class="btn btn-lg btn-danger" data-toggle="popover" title="Popover title" data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
</body>
</html>


推荐答案

你忘了这个:
http://getbootstrap.com/javascript/#opt-in-functionality


出于性能原因,Tooltip和Popover数据apis是选择加入的,这意味着你必须自己初始化它们。

For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning you must initialize them yourself.

初始化页面上所有工具提示的一种方法是通过数据切换属性选择它们:

One way to initialize all tooltips on a page would be to select them by their data-toggle attribute:



$(function () {
    $('[data-toggle="popover"]').popover()
})

这篇关于为什么我的Bootstrap popover不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆