简体   繁体   English

Bootstrap 3 Popover滚动不起作用

[英]Bootstrap 3 popover scroll doesn't work

HTML 的HTML

<div class="pop-div">
    <a href="#" data-toggle="popover" title="<strong>Notifiche</strong>" data-html="true" data-content="Notification 1<hr />Notification 2<hr />Notification 3 <hr />Notification 4">Notifications</a>
    </div>

JAVASCRIPT JAVASCRIPT

$('[data-toggle="popover"]').popover({placement: 'bottom'});

        //hide popover when click outside
        $('body').on('click', function (e) {
            $('[data-toggle="popover"]').each(function () {
                if ($(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
                    $(this).popover('hide');
                }
            });
        });

CSS 的CSS

.pop-div .popover-content {
height: 50px;
overflow-y: scroll;

} }

I have this popover in the code above. 我在上面的代码中有这个弹出窗口。 I'm trying to show a scroll bar on the left of the popover content, but this code doesn't work. 我试图在弹出内容的左侧显示滚动条,但是此代码不起作用。 Any help will be appreciated. 任何帮助将不胜感激。 Thanks! 谢谢!

This is because your CSS declaration is wrong. 这是因为您的CSS声明是错误的。 You should separate the selectors with comma , : 您应该选择用逗号分隔,

.pop-div, .popover-content {

not

.pop-div .popover-content {

in this case .pop-div is unnessecary, you only need 在这种情况下, .pop-div是不必要的,您只需要

.popover-content {
   height: 50px;
   overflow-y: scroll;
}

see fiddle -> http://jsfiddle.net/tv5Vu/ 看到小提琴-> http://jsfiddle.net/tv5Vu/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM