Search code examples
twitter-bootstraptooltipfont-awesome

How to create a tooltip with an awesome font?


How to create a tooltip with an awesome font?

I do not want a button but an awesome logo that displays the tooltip.

The code below does not work.

<i class="fas fa-info-circle fa-2x" data-toggle="tooltip" data-placement="left" title="Tooltip on left"></i>

Here are the bootstrap tooltip:

https://getbootstrap.com/docs/3.3/javascript/#tooltips-examples

Here are the awesome facts that I want to use:

https://fontawesome.com/icons/info-circle?style=solid

Here is my page, the tooltip is not displayed


Solution

  • Check if you didn't forget about some libraries. The following code is working properly.

    $(document).ready(function(){
        $('[data-toggle="tooltip"]').tooltip();   
    });
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
    <!-- jQuery -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <!-- BootstrapJS -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <i class="fas fa-info-circle fa-2x" data-toggle="tooltip" data-placement="right" title="Tooltip on right"></i>