0

我需要社区帮助。我有一张桌子。如果我将鼠标悬停在带有按钮的 tr 块上,则会出现在下一个 tr 上。我需要:当我使用按钮直接阻止时 - 不会丢失,但是当我直接使用 tr 时 - 按钮丢失并打开此 tr 的块。请帮我 )

$('.table-finance').on('mouseenter', 'td', function(e) {
    if (e.target.tagName == 'TD') {
        console.log('enter', 'content=', $(this).text(), 'target=',e.target);
        $(this).parent().find('.more-btn').show();
        e.stopPropagation();
    }
});
$('.table-finance').on('mouseleave', 'td', function(e) {
    if ((!$(e.target).hasClass('.btn-more')) || (e.targer.tagName != 'BUTTON')) {
        console.log('leave', 'content=', $(this).find('td').text(), 'target=',e.target, 'event=', e);
        $(this).parent().find('.more-btn').hide();
        e.stopPropagation();
    }
});

jsfiddle.net

4

0 回答 0