Twitter的Bootstrap弹出窗口不起作用 [英] Twitter's Bootstrap popover not working
本文介绍了Twitter的Bootstrap弹出窗口不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Bootstrap中的popover插件. (链接),但是它不起作用.
I am using the popover plugin from Bootstrap. (link) but it's not working.
HTML:
<a data-placement='above' class='danger' rel='popover' data-content='test code here' href='#'>Click</a>
JavaScript:
Javascript:
<script type='text/javascript' src="../js/jquery.js"></script>
<script type='text/javascript' src="../js/twipsy.js"></script>
<script type='text/javascript' src="../js/popover.js"></script>
推荐答案
最好的方法是添加以下脚本代码:
The best way is add the following script code:
<script>
$(function () {
$("a[rel=popover]")
.popover({
offset: 10
})
.click(function (e) {
e.preventDefault()
})
})
</script>
这样,所有具有属性 rel ="popover" 的 a 元素都会显示此弹出框.
This way, all the a elements with the attribute rel="popover" will get this popover to appear.
不需要对代码进行任何更改,它可以很好地工作……至少在我的机器上,当然;-)
试试吧!
No more changes are needed to your code and it works great... at least on my machine, of course ;-)
Try it out!
这篇关于Twitter的Bootstrap弹出窗口不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文