Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery Tools Tooltip not going away

I have a tool tip that will appear over anything with a title:

$("[title!=]:not(IFRAME)").tooltip();

I have a list of people that can be Added or Removed, you click a remove button that is positioned over the person, you click it to swap out that person for another person.

When you go to click the Remove button the Tool tip shows up, because that item has a . But once you swap that person out, the tooltip will not go away.

I am pretty sure the reason is that once that person is removed you don't have a mouseout, so the tooltip never goes away.

I tried this:

$('.remove-player-large a').click(function() {
  $("[title!=]:not(IFRAME)").tooltip().hide();
});

But no luck Any suggestions on how to fix this?

Does this makes sense ?

like image 311
Xtian Avatar asked Dec 27 '22 22:12

Xtian


1 Answers

You can hide tooltip using hideTooltip() function.

var $tooltip = null;
$(function(){
    $tooltip = $("input[type='text']").tooltip({
        // place tooltip on the right edge
        position: "center right",
        // a little tweaking of the position
        offset: [-2, 10],
        // use the built-in fadeIn/fadeOut effect
        effect: "fade",
        // custom opacity setting
        opacity: 0.6
    });
    $("#close").click(function(){
        hideTooltip();
    });
});
function hideTooltip()
{
    if($tooltip)
    {
        $tooltip.each(function(index){
            var $this = $(this).data('tooltip');
            if($this.isShown(true))
                $this.hide();
        });
    }
}
like image 56
yoku2010 Avatar answered Jan 04 '23 23:01

yoku2010