これはjQuery1.9.0です。私はqTip1.0.0-rc3を使用しています。これは、すべての$.browser
コードを削除したものです(1.9.0以降に表示されなくなったため)。シンプルな裸の骨(今のところスタイルを変更していません)のチップを取り付けます。完全な機能は以下のとおりです。
// Function to report a parse error
function reportParseError(parseError, msgHandle, textArea)
{
// Find the inner link element -- there is only one, so this is "safe".
var link = msgHandle.find("a");
link.text("line " + parseError["line"]);
// Add an onclick hook to the link. When clicking on the link, the caret
// in the text area will move to the position of the error.
link.on("click", function(e)
{
e.preventDefault();
textArea.focus().setCursorPosition(parseError["offset"]);
});
link.qtip({
content: parseError["message"],
show: "mouseover",
hide: "mouseout",
position: {
corner: {
target: "topMiddle",
tooltip: "bottomMiddle"
}
}
});
// Show the message
msgHandle.show();
}
この関数は私が望むことを実行します(ヒントはリンクの上に表示されます)。
問題は、ヒントの以前のコンテンツ(解析メッセージがかなり大きくなる可能性がある)が新しいコンテンツよりも大きい場合です。マウスオーバーで新しいコンテンツの下に古いコンテンツが表示されます(両方のコンテンツがマウスアウトで消えます)。
どのようにそれを解決しますか?
編集:もう少し考えてみると、観察された動作が期待されているようです。この関数がトリガーされるたびに、新しいツールチップが作成されます。つまり、ヒントは「初期化時」(つまり、document.ready()のとき)に添付し、必要に応じて適切なコンテンツを入力する必要があります。私はこれを正しく理解しますか?