悬停在工具提示上时,工具提示会闪烁

问题描述 投票:0回答:1

我在悬停在文本上时出现工具提示。由于工具提示很大,当我将光标移到工具提示上时,它开始闪烁或闪烁。我怎么能阻止这种闪烁?

http://jsfiddle.net/keshav_1007/en5tcjaw/ - 这是小提琴

$(function() {
    /*tooltips*/
    $('.tooltip').hide();
    $('.trigger').mouseover(function() {
        var ttLeft,
            ttTop,
            $this=$(this),
            $tip = $('#ttip'),
            triggerPos = $this.offset(),
            triggerH = $this.outerHeight(),
            triggerW = $this.outerWidth(),
            tipW = $tip.outerWidth(),
            tipH = $tip.outerHeight(),
            screenW = $(window).width(),
            scrollTop = $(document).scrollTop();

        if (triggerPos.top - tipH - scrollTop > 0 ) {
            ttTop = triggerPos.top;
        } else {
            ttTop = triggerPos.top;            
        }

        var overFlowRight = (triggerPos.left + tipW) - screenW;    
        if (overFlowRight > 0) {
            ttLeft = triggerPos.left - overFlowRight - 10;    
        } else {
            ttLeft = triggerPos.left;    
        }


        $tip
           .css({
            left : ttLeft ,
            top : ttTop,
            position: 'absolute'
            })
            .stop(true,true).fadeIn(200);
    }); // end mouseover
    $('.trigger').mouseout(function () {
        $('.tooltip').stop(true,true).fadeOut(200);
    }); // end mouseout
    });

我不希望改变工具提示的位置。我需要在徘徊在工具提示上时停止闪烁。怎么实现呢?

javascript jquery html css html5
1个回答
2
投票

将工具提示“pointer-events”CSS属性设置为“none”。

.tooltip { 
    pointer-events: none;
}
© www.soinside.com 2019 - 2024. All rights reserved.