SyAu
SyAu

Reputation: 1681

jQuery plugin qtip2 - Close tool tip on mouse over of close button

jQuery plugin qtip2, jQuery 1.7.2 - Planning to implement qtip2 in my project and I would like to close the tool tip when I hover over the close button at the top right instead of clicking the button to close the tool tip. Please see my code,

HTML

  <a href="/wiki/Quantum_mechanics" title="Wikipedia: Quantum mechanics">quantum mechanics</a>

Javascript

        $(document).ready(function()
    {
        $('a[title]').qtip({
            content: {
                title: {
                    text: 'About me',button: 'Close'
                }
            },
            show: {
                solo: true
            },
            hide: 'unfocus'
        });
    });

Please see the code in jsbin

Update

Based on Gustavo Simon's answer, the code to close the tool tip on mouse over,

     $("body").on("mouseenter", "a.qtip-close", function(){
        $(this).closest("div.qtip").hide('slow');
     });

Upvotes: 0

Views: 1582

Answers (1)

simongus
simongus

Reputation: 440

Probably not the most elegant solution but works:

$("body").on("mouseenter", "a.qtip-close", function(){
            $('a[title]').qtip('api').hide();
});

I hope it helps

Upvotes: 1

Related Questions