javascript - Bootstrap 3.0 Popovers and tooltips -


i new bootstrap , i'm having trouble getting popover , tooltip features work. had no problem drop downs , models seem missing popover , tooltips.

i getting tooltips show not styled , located bootstrap examples. , popover not working @ all.

please take , let me know 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 , respond.js ie8 support of html5 elements , 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, 4 loko mcsweeney's cleanse vegan chambray. ironic artisan <a href="#" data-toggle="tooltip" title="another 1 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 amazing content. it's engaging. right?">click toggle popover</a>         </div>          <!-- jquery (necessary bootstrap's javascript plugins) -->         <script src="http://code.jquery.com/jquery.js"></script>         <!-- include compiled plugins (below), or include individual files 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> 

turns out evan larsen has best answer. please upvote answer (and/or select correct answer) - it's brilliant.

working jsfiddle here

using evan's trick, can instantiate tooltips 1 line of code:

$('[data-toggle="tooltip"]').tooltip({'placement': 'top'}); 

you see tooltips in long paragraph have working tooltips 1 line.

in jsfiddle example (link above), added situation 1 tooltip (by sign-in button) on default. also, tooltip code added button in jquery, not in html markup.


popovers do work same tooltips:

$('[data-toggle="popover"]').popover({trigger: 'hover','placement': 'top'}); 

and there have it! success @ last.

one of biggest problems in figuring stuff out making bootstrap work jsfiddle... here's must do:

  1. get reference twitter bootstrap cdn here: http://www.bootstrapcdn.com/
  2. paste each link notepad , strip out except url. example:
    //netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css
  3. in jsfiddle, on left side, open external resources accordion dropdown
  4. paste in each url, pressing plus sign after each paste
  5. now, open "frameworks & extensions" accordion dropdown, , select jquery 1.9.1 (or whichever...)

now ready go.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -