2011-09-28 15 views
6

Ho provato a implementare javascript popover sul mio sito con twitter bootstrap e non ho potuto. Se qualcuno potesse aiutarmi con il mio codice, apprezzerei molto. grazie in anticipo per questoproblemi "popover" su twitter bootstrap css/libreria javascript

<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> 

ho provato "html: true" e l'esempio doc bootstrap "offset: 10". Mostra il pulsante rosso di pericolo, ma non succede nulla (il popover non funziona).

E qualcos'altro, come potrei implementarlo sull'elemento TD della tabella piuttosto che sul pulsante?

risposta

4

Change questi 2 script intorno come popover è un'estensione del Twipsy e ha bisogno di essere caricato prima ...

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

Non è necessario impostare html su true, ecco la mia con le opzioni è possibile modificare se si desidera

$(function(){$(".btn") 
        .popover({ 
         offset: 5, 
         placement: 'left' 
        }); 
       }); 
+0

questo ha funzionato senza intoppi. Ma cosa fa esattamente l'attributo offset? – Pabluez

+1

@Pabluez puoi vedere tutte le opzioni per il popover qui: http://twitter.github.com/bootstrap/javascript.html#popover – wes

+0

Al giorno d'oggi, devi includere "tooltip.js" invece di "twipsy.js". –

Problemi correlati