2011-01-03 7 views
1

Ich benutze JQuery-Plugin qtip zur Anzeige Tooltip in asp.net-Anwendung. Hier ist mein Code:Jquery-Plugin qtip Hilfe

$("ul li").css("width","90px"); 
     $('ul li').each(function(){ 
      $(this).qtip({ 
       content: $(this).attr("title"), 
       show: 'mouseover', 
       hide: 'mouseout', 
       position:{ 
       corner:{ 
        target:'topRight', 
        tooltip: 'bottomLeft'  
       } 
       }, 
       style:{ 
       width:150, 
       padding:5, 
       background: '#A2D959', 
       color: 'black', 
       textAlign: 'left', 
       border: { 
       width: 0, 
       radius: 7, 
       color: '#A2D959' 
       }, 
       tip: 'bottomLeft', 
       name: 'dark' 
       } 
      }) 
     }); 


<ul> 
      <br /> 
      <li title="This is Item no. 1"><a>menu item111</a><br /> 
      <li title="This is Item no. 2"><a>menu item2222</a><br /> 
      <li title="This is Item no. 3"><a>menu item3333</a><br /> 
     </ul> 
     <ul> 
      <br /> 
      <li title="This is Item no. 4"><a>menu item4444</a><br /> 
      <li title="This is Item no. 5"><a>menu item5555</a><br /> 
      <li title="This is Item no. 6"><a>menu item6666</a><br /> 
     </ul> 

Wenn ich den Cursor über jedem li dann beide qtip Tooltip und eingebauten HTML Tooltip bewegen, werden die Anzeige, aber ich möchte nur qtip tooltip.How angezeigt werden kann ich das tun.

Sie können auch Hilfe von gegebenem Bild erhalten. alt text Dank

Antwort

0

können Sie entfernen, dass title Attribut nach dem qtip über .removeAttr(), wie dies zu schaffen:

$("ul li").css("width","90px") 
      .each(function(){ 
    $(this).qtip({ 
     content: $(this).attr("title"), 
     show: 'mouseover', 
     hide: 'mouseout', 
     position:{ 
     corner:{ 
      target:'topRight', 
      tooltip: 'bottomLeft'  
     } 
     }, 
     style:{ 
     width:150, 
     padding:5, 
     background: '#A2D959', 
     color: 'black', 
     textAlign: 'left', 
     border: { 
     width: 0, 
     radius: 7, 
     color: '#A2D959' 
     }, 
     tip: 'bottomLeft', 
     name: 'dark' 
     } 
    }).removeAttr("title"); 
}); 
+0

Dank Nick! Jetzt habe ich den richtigen Eintrag.aber ich habe einen Zweifel, dass wenn ich nach Jquery-Syntax zum Menüpunkt 6 gehe, entfernen wir Titelattribut und wieder, wenn ich zu diesem gehe, wie es Titeltext in Qtip wieder anzeigt, wie wir es bereits entfernt haben. – Sukhjeevan

+0

@Sukhi - Ich folge nicht vollständig, können Sie das Problem, das Sie sehen, besser beschreiben? –

0

den Titel-Attribut auf etwas anderes wie customtitle

<li customtitle="this is item no.1><a>menu item111</a></li> 

und

verwenden umbenennen
content: $(this).attr("customtitle"), 
0

Änderungen

$("ul li").css("width","90px"); 
     $('ul li').each(function(){ 
      $(this).qtip({ 
       content: $(this).attr("rel"), // changes are here 
       show: 'mouseover', 
       hide: 'mouseout', 
       position:{ 
       corner:{ 
        target:'topRight', 
        tooltip: 'bottomLeft'  
       } 
       }, 
       style:{ 
       width:150, 
       padding:5, 
       background: '#A2D959', 
       color: 'black', 
       textAlign: 'left', 
       border: { 
       width: 0, 
       radius: 7, 
       color: '#A2D959' 
       }, 
       tip: 'bottomLeft', 
       name: 'dark' 
       } 
      }) 
     }); 


<ul> 
      <br /> 
      <li rel="This is Item no. 1"><a>menu item111</a><br /> // and here 
      <li rel="This is Item no. 2"><a>menu item2222</a><br />// and here 
      <li rel="This is Item no. 3"><a>menu item3333</a><br />// and here 
     </ul> 
     <ul> 
      <br /> 
      <li rel="This is Item no. 4"><a>menu item4444</a><br />// and here 
      <li rel="This is Item no. 5"><a>menu item5555</a><br />// and here 
      <li rel="This is Item no. 6"><a>menu item6666</a><br />// and here 
     </ul> 

in Bezug

Wazzy

+1

Danke Wazzy. Diese Lösung hat auch für mich funktioniert. – Sukhjeevan