Twitter Bootstrap popover trigger: how to set multiple triggers?

前端 未结 5 1447
挽巷
挽巷 2020-12-16 14:27

I\'m trying to use http://twitter.github.io/bootstrap/javascript.html#popovers. I can set the trigger to any one of click | hover | focus | manual. Is there a w

5条回答
  •  一生所求
    2020-12-16 15:02

    This is easy enough to accomplish by defining your own event handlers and showing/hiding the popover via the API:

    HTML:

    
    
    

    JavaScript:

    var showPopover = function () {
        $(this).popover('show');
    }
    , hidePopover = function () {
        $(this).popover('hide');
    };
    
    $('#has-popover').popover({
        content: 'Popover content',
        trigger: 'manual'
    })
    .focus(showPopover)
    .blur(hidePopover)
    .hover(showPopover, hidePopover);
    

    Example: http://jsfiddle.net/Xqx8P/

提交回复
热议问题