简体   繁体   中英

Bootstrap Tooltips Not Displaying On Hover

I've tried a few different ways to get Bootstrap tooltips working. I can't seem to find what's wrong with this. I've used Bootstrap tooltips before and it seems I always have an issue getting them going. Am I missing something obvious here? I'm not getting any JS errors or anything.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Quick Links</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- jQuery 
    <script type='text/javascript' src='js/jquery-2.1.1.min.js'></script> -->

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style type='text/css'>
    </style>
  </head>
  <body>
    <div class="container" style='text-align:center;'>
        <h1>Quick Links</h1>
        <div class='well'>
            Quick links
        </div>
        <div>

            <div class='row'>
                <div class='col-md-3 hidden-xs'>
                </div>
                <div class='col-md-3'><a target='_blank' class='qtooltip btn btn-primary btn-lg btn-block' data-toggle='tooltip' href='http://www.google.ca'>google</a></div>
                <div class='col-md-3'><a target='_blank' class='qtooltip btn btn-primary btn-lg btn-block' data-toggle='tooltip' href='http://www.google.ca'>google</a></div>
                <div class='col-md-3 hidden-xs'>
                </div>
            </div>      </div>
    </div><!-- /.container -->

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>

    <script type='text/javascript'>
    $(document).ready(function () {
        $('.qtooltip').tooltip({'placement': 'top'});
    });
    </script>
  </body>
</html>

I have found the issue.

Working fiddle here: http://jsfiddle.net/8dfwcL98/

In your case you forgot to add a title property to your element. Title is what is displayed as the tooltip.

<a target='_blank' class='qtooltip btn btn-primary btn-lg btn-block' data-toggle='tooltip' href='http://www.google.ca' title="Awesome Tooltip">google</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM