Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3.0 Popovers and tooltips

I am new to Bootstrap and I'm having trouble getting the popover and tooltip features to work. I had no problem with the drop downs and models but I seem to be missing something for the popover and tooltips.

I am getting tooltips to show up but they are not styled and located like the bootstrap examples. And the popover is not working at all.

Please take a look and let me know what I am missing.

       <!DOCTYPE html>     <html>       <head>         <title>Bootstrap 101 Template</title>         <meta name="viewport" content="width=device-width, initial-scale=1.0">         <!-- Bootstrap -->         <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">         <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet" media="screen">         <link href="css/font-awesome.min.css" rel="stylesheet" media="screen">         <link href="css/index.css" rel="stylesheet" media="screen">         <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->         <!--[if lt IE 9]>           <script src="../../assets/js/html5shiv.js"></script>           <script src="../../assets/js/respond.min.js"></script>         <![endif]-->       </head>       <body>        <p id="tool"class="muted" style="margin-bottom: 0;">         Tight pants next level keffiyeh         <a href="#" data-toggle="tooltip" title="Default tooltip">you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" data-toggle="tooltip" title="Another tooltip">have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan <a href="#" data-toggle="tooltip" title="Another one here too">whatever keytar</a>, scenester farm-to-table banksy Austin <a href="#" data-toggle="tooltip" title="The last tip!">twitter handle</a> freegan cred raw denim single-origin coffee viral.</p>        <h3>Live demo</h3>         <div style="padding-bottom: 24px;">           <a id="pop" href="#" class="btn btn-lg btn-danger" data-toggle="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">Click to toggle popover</a>         </div>          <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->         <script src="http://code.jquery.com/jquery.js"></script>         <!-- Include all compiled plugins (below), or include individual files as needed -->         <script type="text/javascript">             $(document).ready(function() {                  $('.tool').tooltip();                 $('.btn').popover();              }); //END $(document).ready()          </script>          <script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.min.css"></script>        </body>      </html> 
like image 217
user2560895 Avatar asked Aug 23 '13 20:08

user2560895


People also ask

What is the difference between tooltip and popover?

Tooltip: use tooltips to show a short text to respondents when they hover over a word or icon. Popover: use popovers to show a longer text, or when you want to have a link to an external web page. It is shown when the respondent clicks on a word or icon.

How do I use bootstrap 3 tooltip?

How To Create a Tooltip. To create a tooltip, add the data-toggle="tooltip" attribute to an element. Note: Tooltips must be initialized with jQuery: select the specified element and call the tooltip() method.

How do I use popovers in bootstrap?

To create a popover, add the data-toggle="popover" attribute to an element. Note: Popovers must be initialized with jQuery: select the specified element and call the popover() method.

How do I customize bootstrap popover?

To create a popover, you need to add the data-bs-toggle="popover" attribute to an element. Whereas, popover's title and its content that would display upon trigger or activation can be specified using the title and data-bs-content attribute respectively. Here is the standard markup for adding a popover to a button.


1 Answers

I use this on all my pages to enable tooltip

$(function () { $("[data-toggle='tooltip']").tooltip(); }); 
like image 193
Evan Larsen Avatar answered Sep 21 '22 13:09

Evan Larsen