Adding custom class to tooltip

后端 未结 8 977
一生所求
一生所求 2021-02-05 02:04

I want to style(css) some bootstrap-tooltip.js tooltips, without affecting all the tooltips. I have tried many different solutions but i allways end up adding a class to the ele

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-05 02:47

    Add a custom class/id in tool tip element as like :

    Here tooltip is needed
    

    Trigger the script as follows,

    $('.red-tooltip').on('show.bs.tooltip', function(){
        $($(this).data('bs.tooltip').tip).addClass('yourclassname');
    });
    

    Add css properties for the class 'yourclassname'.

    .redtooltip.tooltip > .tooltip-inner{
        background-color:#FF5257;
        box-shadow: 0px 0px 4px 0px #FF5257 !important;
    }
    

提交回复
热议问题