最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Bootstrap 3 popover scroll doesn't work - Stack Overflow

programmeradmin0浏览0评论

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;

}

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!

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;

}

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!

Share Improve this question asked Jan 29, 2014 at 12:32 ValentinoValentino 2,1351 gold badge20 silver badges26 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

This is because your CSS declaration is wrong. You should separate the selectors with ma , :

.pop-div, .popover-content {

not

.pop-div .popover-content {

in this case .pop-div is unnessecary, you only need

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

see fiddle -> http://jsfiddle/tv5Vu/

发布评论

评论列表(0)

  1. 暂无评论