2011-09-28 21 views
6

He intentado implementar Javascript de popover en mi sitio con twitter bootstrap y no pude. Si alguien pudiera ayudarme con mi código, apreciaría mucho. gracias de antemano por eso.problemas de "popover" en twitter biblioteca css/javascript de bootstrap

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

He intentado "html: true" y el ejemplo de bootstrap doc "offset: 10". Muestra el botón de peligro rojo, pero no sucede nada en ese momento (el popover no funciona).

Y algo más, ¿cómo podría implementar esto en el elemento TD de la tabla en lugar del botón?

Respuesta

4

cambiar estos 2 guiones alrededor como popover es una extensión de twipsy y necesita ser cargado primero ...

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

No es necesario para establecer html en verdad, aquí está la mía con opciones que puede cambiar si lo desea

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

esto funcionó sin problemas. Pero, ¿qué hace exactamente el atributo de compensación? – Pabluez

+1

@Pabluez puede ver todas las opciones de popover aquí: http://twitter.github.com/bootstrap/javascript.html#popover – wes

+0

Hoy en día, debe incluir 'tooltip.js' en lugar de 'twipsy.js'. –

Cuestiones relacionadas