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!

有帮助吗?

解决方案

This is because your CSS declaration is wrong. 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

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

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top