Search code examples
jqueryjquery-animatetipsy

Jquery - Removing hover before animation ends


Here is the code:

 $('.rightside').click(function(){
    if($('#clickForm').is(":visible")) {
       $('#clickForm').hide("slide", { direction: "left" }, 500);
       $('.left_slider').animate({left:"0"}, 500).css('background-image','url(images/leftPanel/gear.png)').attr('title','Open');

       $("#blackbg").hide();
    }
    else
    {
       $('#clickForm').show("slide", { direction: "left" }, 500);
       $('.left_slider').animate({left:"314px"}, 500).css('background-image','url(images/leftPanel/close.png)').attr('title','Close');
        $("#blackbg").show();
    }
 });

Problem is this. Here is the picture before animation

before animation

and after animation

after

This stays like this untill i move mouse at least 1px or click. For tooltips i am using tipsy. I can make my own if it will help.


Solution

  • To answer my own question if someone else gets same problem:

    ALl i had to do is add

    $(".tipsy").remove();

    just after click function.

    So if u are working with jquery animations and having issue with tipsy, just add above code.

    Regarding hover, ive did it with jquery. Maybe there was easier and more "correct" way to do this, but untill then, this will do:

        $('.rightside').click(function(){
        $(".tipsy").remove();
        if($('#clickForm').is(":visible")) {
           $('#clickForm').hide("slide", { direction: "left" }, 500);
    
           $('.left_slider').animate({left:"0"}, 500).css({'background-image':'url(images/leftPanel/gear.png)',
                         'background-color':'#fff'}).attr('title','Open');
    
           $("#blackbg").hide();
        }
        else
        {
           $('#clickForm').show("slide", { direction: "left" }, 500);
            $('.left_slider').animate({left:"314px"}, 500).css({'background-image':'url(images/leftPanel/close.png)',
                         'background-color':'#fff'}).attr('title','Close');
    
           $("#blackbg").show();
        }
     });