該段js代碼可實現 popover 下鼠標移入移除時顯示、隱藏 popover 提示信息功能
var strContent = '<div class="media"><div class="position-left media-left"><img class="img-circle" src="/assets/images/avatar.jpg">'+
'</div>'+
'<div class="media-body">'+
'<h4 class="media-title">小標題</h4>'+
'<p><strong>張三</strong> <span class="label label-primary">管理員</span></p>'+
'</div>'+
'</div>';
$( 'li#user_avatar' ).popover({
trigger:'manual',
placement:'bottom',
html:true,
container:'#bs-example-navbar-collapse-1',
content:strContent,
}).on( 'mouseenter', function(){
var _this = this;
$(this).popover( 'show' );
$(this).siblings( '.popover' ).on( 'mouseleave' , function () {
$(_this).popover( 'hide' );
});
}).on( 'mouseleave', function(){
var _this = this;
setTimeout(function () {
if (!$( '.popover:hover' ).length) {
$(_this).popover( 'hide' )
}
}, 100);
});