2 回答
TA贡献1830条经验 获得超3个赞
如果您的 css 没有动态更改,则仅使用 css
.popover .popover-content,.popover .popover-title {
color: red;
}
但是如果你动态地改变你的身体,那么你可以为你的弹出框添加类。Popover 总是.popover作为类名,所以你可以
$(document).ready(function () {
$(function () {
$('[data-toggle="popover"]').popover()
});
});
function popchange(){
setTimeout(function () {
$(".popover").addClass('popover-danger');
}, 10);
}
.popover-danger {
color: red;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<button type="button" class="btn btn-sm btn-danger" data-toggle="popover"onclick="popchange()" title="Popover title" data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
添加回答
举报