在页面加载中加载Twitter Bootstrap Popover [英] Load a Twitter Bootstrap Popover on Page load
本文介绍了在页面加载中加载Twitter Bootstrap Popover的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下BootStrap弹出窗口:
I have the following BootStrap popover:
<a href='#' id='example' rel='popover' data-placement='left' data-content='Its so simple to create a tooltop for my website!' data-original-title='Twitter Bootstrap Popover'>HEY</a>
我想在页面加载时显示它,所以我添加了
And I want to show it when the page loads, so I added
$('#example').popover('show')
在文档末尾具有以下功能:
to a function as follows at the end of the document:
<script>
$(function ()
{ $("#example").popover(show);
});
</script>
但什么也没发生.
页面加载后我什么也没得到.但是,当我在控制台中运行$('#example').popover('show')
时,弹出窗口就会起作用.页面加载后如何显示弹出窗口?
On page load I get nothing. However when I run $('#example').popover('show')
in the console I get the popover working. How can I make the popover be shown when the page has loaded?
推荐答案
我发现这种方式很方便:
I found this way to be convenient:
您可以一口气触发显示"并设置选项:
You can trigger the 'show' and set options in one fell swoop:
$('#elementToPointAt').popover({
'placement':'bottom',
'content':'Look at me!'
}).popover('show');
这篇关于在页面加载中加载Twitter Bootstrap Popover的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文