Dynamically add a class to Bootstrap's 'popover' container

后端 未结 22 2590
名媛妹妹
名媛妹妹 2020-11-29 18:27

I\'ve thoroughly searched through both StackOverflow and Google, but come up empty. So apologies in advance if this has been asked & resolved already.

NB

22条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 18:57

    for bootstrap v3.3.2 you find these lines on bootstrap.js

       $tip
        .detach()
        .css({ top: 0, left: 0, display: 'block' })
        .addClass(placement)
        .data('bs.' + this.type, this)
    

    Then you add this line

        .addClass(this.$element.attr("data-class")) 
    

    Now to add a class on your popover element, you will be just putting an attribute data-class="classexemple" then everything works perfect

    Find us on www.mixpres.com

提交回复
热议问题