Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"popover" problems on twitter bootstrap css/javascript library

I've tried to implement popover javascript on my site with twitter bootstrap and i couldn't. If anyone could help me with my code, i would appreciate a lot. thanks in advance for that.

<head>
...
    <script src="scripts/jquery.min.js"></script>
    <script src="scripts/html5.js"></script>  
    <script src="scripts/bootstrap-tabs.js"></script>
    <script src="scripts/bootstrap-alerts.js"></script>
    <script src="scripts/bootstrap-popover.js"></script>
    <script src="scripts/bootstrap-twipsy.js"></script>
    <script src="scripts/bootstrap-modal.js"></script>
    <script src="1.3.0/bootstrap-scrollspy.js"></script> -->

    <link rel="stylesheet" href="bootstrap.css" />

...
</head>
<body>
...

                                <div class="tab-content">
                                    <div class="active" id="dwcenter_iso">
                                        <table class="zebra-striped">
                                            <thead>
                                                <tr>
                                                    <th>Arquivo</th>
                                                    <th>Tamanho</th>
                                                    <th>Data</th>
                                                    <th>md5</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <td><a href="download.php">nimbus-opensource-backup-1.1.iso</a> <span class="label success">new</span></td>
                                                    <td>332M</td>
                                                    <td>16/09/11</td>

<!-- HERE GOES -->
                                                 <td><a href="#" class="btn danger" rel="popover" title="md5 Check Sum" data-content="343453453453453rfef34">ver</a>
                                                       <script>
                                                                $(function () {
                                                          $('a[rel=popover]')
                                                            .popover({
                                                              html: true
                                                            })
                                                            .click(function(e) {
                                                              e.preventDefault()
                                                            })
                                                        })
                                                      </script> 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>nimbus-opensource-backup-1.0.iso <span class="label important">deprecated</span></td>
                                                    <td>332M</td>
                                                    <td>10/08/11</td>
                                                    <td>ver</td>
                                                </tr>
                                                <tr>
                                                    <td>nimbus-opensource-backup-0.9beta.iso <span class="label important">deprecated</span></td>
                                                    <td>380MB</td>
                                                    <td>25/09/10</td>
                                                    <td>ver</td>
                                                </tr>

                                            </tbody>
                                        </table>
                                    </div>


...
</body>

i have tried "html: true" and the bootstrap doc example "offset: 10". It does shows the red danger button, but nothing happens then (the popover doesn't work).

And something else, how could i implement this on the TD element of the table rather than the button?

like image 253
Pabluez Avatar asked Sep 28 '11 14:09

Pabluez


1 Answers

Change these 2 scripts around as popover is an extension of twipsy and needs to be loaded first...

<script src="scripts/bootstrap-twipsy.js"></script>
<script src="scripts/bootstrap-popover.js"></script>

You don't need to set html to true, here's mine with options you can change if you wish

$(function(){
   $(".btn").popover({
       offset: 5,
       placement: 'left'
    });
});
like image 177
Adam Collingburn Avatar answered Nov 14 '22 19:11

Adam Collingburn