Bootstrap popover 实现鼠标移入移除显示隐藏功能

该段js代码可实现 popover  下鼠标移入移除时显示、隐藏 popover  提示信息功能


var strContent = '
'+ '
'+ '
'+ '

小标题

'+ '

张三 管理员

'+ '
'+ '
'; $( '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); });


你可能感兴趣的:(Bootstrap)