2012-03-31 12 views
0

Ich habe Probleme, die Standard-Tooltip des Browsers durch qTip zu ersetzen. Bisher habe ich:Browser Tooptip durch qTip ersetzen

$('[title]').each(function(){ 
     var cont = $(this).attr('title'); 
     if(cont != ''){ 
      $(this).qtip({ 
       content: cont, 
       style: { 
        background: '#FFFFCC', 
        color: '#000000', 
        name: 'cream' , 
        border: {      
         radius: 4, 
         color: '#FCC200' 
        }, 
        textAlign:'center', 
        tip: { 
         corner: 'bottomLeft', 
         size: { 
          x: 20, 
          y: 8 
         } 
        } 
       }, 
       position: { 
        corner: { 
         target: 'topRight', 
         tooltip: 'bottomLeft' 
        } 
       }    
      }); 
     } 
    }); 

Aber tatsächlich in Browser erhalte ich:

enter image description here

ich wirklich zu schätzen Ihre Hilfe.

Danke.

Antwort

2

Das Plugin Standard für den Inhalt ist der Titel-Attribut, wenn Sie also den Inhalt Option von Ihrem Initialisierungscode entfernen, Plugin sollte aus dem Attribut des Entfernens Element kümmern

Von docs:

Ersetzen Die normalen alten Titel-Tooltips Ihres Browsers sind einfach.
rufen Sie einfach die qtip() -Methode für alle Verbindungselemente ohne Inhalt
Option (es wird das Titel-Attribut des Ziels verwendet standardmäßig).

+0

Vielen Dank. –

2

Anruf removeAttr('title') auf Ihrer Sammlung.

Der Browser zeigt nicht das Standard-title Attribut.

+0

Vielen Dank. –

0

Dies ist die Lösung:

 $('[title]').qtip({ 
     style: { 
      background: '#FFFFCC', 
      color: '#000000', 
      name: 'cream' , 
      border: {      
       radius: 4, 
       color: '#FCC200' 
      }, 
      textAlign:'center', 
      tip: { 
       corner: 'bottomLeft', 
       size: { 
        x: 20, 
        y: 8 
       } 
      } 
     }, 
     position: { 
      corner: { 
       target: 'topRight', 
       tooltip: 'bottomLeft' 
      } 
     }    
    }); 

Dieser Code-Schnipsel Tooltip für alle Komponenten mit dem Titel vorhanden Attribut machen.