Ich habe eine Div mit der folgenden Struktur:
<div id="notify" ><a href="javascript:void(0);" title=""></a></div>
Ich möchte das Widget der jQuery-QuickInfo-Benutzeroberfläche zum wiederholten Öffnen und Schließen bei wiederholten Aktualisierungen eines anderen Div mit Ajax verwenden. Mein Code-Snippet für den Tooltip ist wie folgt
jQuery( "#notify a" ).tooltip({
show: { effect: "blind", duration: 800 },
hide: { effect: "blind", duration: 800 }
});
var tooltipTxt = r[x].name+" is "+r[x].status.toLowerCase();
jQuery( "#notify a" ).tooltip({content: tooltipTxt});
jQuery("#notify a").tooltip("open");
setTimeout(function(){
jQuery( "#notify a" ).tooltip("close");
}, 3000);
Hier ist "r" ein mit AJAX abgerufener JSON
Das Problem ist, dass der Tooltip nur einmal geöffnet und geschlossen wird. Wenn dies nicht gelöst werden kann, welches Widget für die Benutzeroberfläche in dieser Situation verwendet wird.
Antworten:
0 für die Antwort № 1jQuery( "#notify a" ).tooltip({
show: { effect: "blind", duration: 800 },
hide: { effect: "blind", duration: 800 }
});
var tooltipTxt = r[x].name+" is "+r[x].status.toLowerCase();
jQuery( "#notify a" ).tooltip("enable");
jQuery( "#notify a" ).attr("title", tooltipTxt);
jQuery( "#notify a" ).tooltip({ content: tooltipTxt});
jQuery("#notify a").tooltip("open");
setTimeout(function(){
jQuery( "#notify a" ).tooltip("disable");
}, 3000);
Ich fand die obige Problemumgehung mit .tooltip ("enable") und .tooltip ("disable") statt .tooltip ("open") und .tooltip ("close")
Ich setze auch das title-Attribut des Tooltips manuell mit jQuery ("#notify a") .attr ("title", tooltipTxt);