Popover Bootstrap - 如何让它更干净
Popover Bootstrap - How to make it cleaner
我正在尝试找出构建弹出窗口的不同方法,而不必在标记中声明它的所有属性。是否可以将它分组在 class 中,或者在 .popover() 中声明它?
例如,是否可以更改
<a href="#" id="example" class="btn btn-primary" rel="popover"
data-content="This is the body of Popover"
data-original-title="Creativity Tuts">pop
</a>
$(function () {
$('#example').popover();
});
像这样更干净的东西
<a href="#" id="cleaner" class="btn btn-primary">pop2</a>
$(function () {
$('cleaner').popover({
//where I would rather declare rel="popover",
//data-content="This is the body of Popover" and so on.
});
});
这是我的 jsfiddle.
提前致谢。
是的,有可能,给你:
$(function () {
$('#cleaner').popover({
content : "This is the body of popover",
title : "Creativity Tuts",
});
});
我觉得你要注意
docs
当然可以:
$(function () {
$('#cleaner').attr({
'rel': 'popover',
'data-content': 'This is the body of Popover',
'data-original-title': 'Creativity Tuts'
});
$('#cleaner').popover();
});
我正在尝试找出构建弹出窗口的不同方法,而不必在标记中声明它的所有属性。是否可以将它分组在 class 中,或者在 .popover() 中声明它?
例如,是否可以更改
<a href="#" id="example" class="btn btn-primary" rel="popover"
data-content="This is the body of Popover"
data-original-title="Creativity Tuts">pop
</a>
$(function () {
$('#example').popover();
});
像这样更干净的东西
<a href="#" id="cleaner" class="btn btn-primary">pop2</a>
$(function () {
$('cleaner').popover({
//where I would rather declare rel="popover",
//data-content="This is the body of Popover" and so on.
});
});
这是我的 jsfiddle.
提前致谢。
是的,有可能,给你:
$(function () {
$('#cleaner').popover({
content : "This is the body of popover",
title : "Creativity Tuts",
});
});
我觉得你要注意 docs
当然可以:
$(function () {
$('#cleaner').attr({
'rel': 'popover',
'data-content': 'This is the body of Popover',
'data-original-title': 'Creativity Tuts'
});
$('#cleaner').popover();
});