Make Bootstrap Popover Appear/Disappear on Hover instead of Click

后端 未结 5 2025
滥情空心
滥情空心 2020-12-04 06:02

I\'m building a website with Bootstrap\'s Popover and I can\'t figure out how to make the popover appear on hover instead of click.

All I want to do is have a popove

5条回答
  •  感情败类
    2020-12-04 06:29

    After trying a few of these answers and finding they don't scale well with multiple links (for example the accepted answer requires a line of jquery for every link you have), I came across a way that requires minimal code to get working, and it also appears to work perfectly, at least on Chrome.

    You add this line to activate it:

    $('[data-toggle="popover"]').popover();
    

    And these settings to your anchor links:

    data-toggle="popover" data-trigger="hover"
    

    See it in action here, I'm using the same imports as the accepted answer so it should work fine on older projects.

提交回复
热议问题