Twitter's Bootstrap popover not working
-
28-10-2019 - |
题
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:
<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>
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!
不隶属于 StackOverflow