Keshav1007
Keshav1007

Reputation: 625

Tooltip flickers while hovering on the tooltip

I have a tootlip appearing while hovering on a text. Since the tooltip is big when i am moving the cursor over the tooltip it starts flickering or blinking. How can i stop that flickering?

http://jsfiddle.net/keshav_1007/en5tcjaw/ - here is the fiddle

$(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
    });

I dont want the position of the tooltip to be changed. I need to stop the flickering while hovering on the tooltip. How to achieve that?

Upvotes: 15

Views: 15699

Answers (1)

CorvusCorax
CorvusCorax

Reputation: 469

Set your tooltip "pointer-events" CSS property to "none".

.tooltip { 
    pointer-events: none;
}

Upvotes: 45

Related Questions