@Minusator

Как скрыть tooltip при клике на объект внутри него jquery?

Всем привет.
При клике на иконку появляется окно со смайлами (img).
Как сделать так, чтобы tooltip скрывался при клике на изображение внутри него?

Тултип - .my-tooltip-contain
Изображение (объект) - .smiles

jQuery(document).ready(function ($) {
    $('body').click(function () {
        $('.my-tooltip-contain').hide();
    });

    $(document).delegate('.my-tooltip-contain', 'click', function () {
        $(this).show();
    });

    $(document).delegate('.icon', 'click', function () {
        var IconId = $(this).attr('id');
        var uniqueId = IconId.substring(IconId.lastIndexOf('-') + 1);
        $('#smyle-' + uniqueId).toggle();
    });

    $(document).delegate('.smiles', 'click', function () {
        var uniqueId = SmileUniqueId($(this), '.container');
        var smileCode = $(this).data('emoticon-code');
        if (smileCode.length && uniqueId.length) {
            smileCode = ' :' + smileCode + ': ';
            if (uniqueId === 'quicktags') {
                $('.container textarea').insertAtCaret(smileCode);
                tinyMCE.activeEditor.execCommand('mceInsertContent', 0, smileCode);
            } else if (uniqueId === '0_0') {
                $('#form-wrapper-0_0 textarea.comment').insertAtCaret(smileCode);
            } else {
                $('form-wrapper-' + uniqueId + ' textarea.comment').insertAtCaret(smileCode);
            }
        }
    });

});


Благодарю за помощь.
  • Вопрос задан
  • 527 просмотров
Пригласить эксперта
Ответы на вопрос 1
Stalker_RED
@Stalker_RED
$(document).delegate('.smiles', 'click', function () {
    $('.my-tooltip-contain').hide(); // добавить строчку
    . . .
})
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы