简体   繁体   中英

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;

}

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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