繁体   English   中英

Bootstrap 3 Popover滚动不起作用

[英]Bootstrap 3 popover scroll doesn't work

的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

$('[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

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

}

我在上面的代码中有这个弹出窗口。 我试图在弹出内容的左侧显示滚动条,但是此代码不起作用。 任何帮助将不胜感激。 谢谢!

这是因为您的CSS声明是错误的。 您应该选择用逗号分隔,

.pop-div, .popover-content {

.pop-div .popover-content {

在这种情况下, .pop-div是不必要的,您只需要

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

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

暂无
暂无

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

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