Bootstrap 3 popover and tooltip on the same element

后端 未结 3 1538
自闭症患者
自闭症患者 2021-02-07 16:26

it is possible to use a tooltip and popover of Bootstrap 3 on the same element?

I have a table and want to show on each row (tr) a tooltip. Additionally I want to show

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-07 17:20

    I needed both tooltip and popover on the same element. The tooltip is for information when the user hovers, and the popover is for a confirmation box when they click.

    In this case, I need the tooltip to go away when the popover appears. I added a little bit of code to @davidkonrad's solution like this:

      $(this).popover({    
        content : $(this).attr("popover-content"),
        title : $(this).attr("popover-title")         
      }).tooltip({    
        placement : 'bottom',  
        title : $(this).attr("tooltip-title")         
      }).on('show.bs.popover', function() {
        $(this).tooltip('hide')
      })
    

提交回复
热议问题