これについてはどうすればよいかわかりませんが、基本的には、またはのいずれかのツールチップを削除するツールチッププラグインを作成しましmouseoutたmousedown。
mousedownイベントがトリガーされると、問題のないものが削除され、ツールチップが削除されますが$that.parent()、ユーザーがマウスアウトイベントもトリガーすると(mouseoverおよびmouseoutイベントが現在チェーンされているため)、別のDOM要素が削除されます。私はしたくないです。だから本質的に私はこれが可能かどうか疑問に思っています:
$that.on('mouseover', function() {
    // If this event is triggered within the mouseover event, don't run the chained mouseout event
    $that.on('mousedown', function() {
        $that.parent().next().fadeOut(100).remove();
        return false;
    });
}).mouseout(function() {
  // If they clicked above, don't run this
    $that.parent().next().fadeOut(100).remove();
});
私の知る限り、グローバル変数を使用しないと、そのイベントclicked内のブールセットにアクセスするのは困難です。例:mousedown
$that.on('mouseover', function() {
    clicked = false;
    // If this event is triggered within the mouseover event, don't run the chained mouseout event
    $that.on('mousedown', function() {
        clicked = true;
        $that.parent().next().fadeOut(100).remove();
        return false;
    });
}).mouseout(function() {
    // If they clicked above, don't run this
    if (clicked) {
        $that.parent().next().fadeOut(100).remove();
    }
});
これをエレガントに構築する方法について何か考えはありますか?
編集:の要素$that.parent().next()はただ<div class="js-tooltip"><span>Tooltip text</span></div>
ただし、グローバル変数を使用せずにトリガーされたmouseover場合にその関数から戻ることができるかどうかを知りたいので、これは関係ありません。mousedown