how to add animation on bootstrap Tooltip?

前端 未结 2 1351
误落风尘
误落风尘 2021-02-10 23:21

Is there any way to add slide down animation on bootstrap tooltip, when hover.

\"facebook\"

相关标签:
2条回答
  • 2021-02-11 00:22

    The tooptip is not generated until you hover the element. You need to add the respective class from animate.css after tooltip is shown.

    $(function () {
        $('[data-toggle="tooltip"]').tooltip();
        $('[data-toggle="tooltip"]').on('shown.bs.tooltip', function () {
            $('.tooltip').addClass('animated swing');
        })
    })
    

    Fiddle demo

    0 讨论(0)
  • 2021-02-11 00:23

    Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-animation="".

    -- You need to care about bootstarp documentation from here that Apply a CSS fade transition to the tooltip not a class like animated slideInDown. By the way it's an boolean type.

    animate.css is suggesting you to add classes for the elements, you want animated.

    So you need to add some extra jquery like :

        $('[data-toggle="tooltip"]').hover(function (){
              $(this).next().addClass("animated shake");               
        });
    
    0 讨论(0)
提交回复
热议问题