سؤال

jQuery("#na").mouseover(function()
{
    jQuery("#na").animate({width:"325px", height:"203px", left:"-40px", top:"-25px"}, 200)
});

jQuery("#na").mouseout(function()
{
    jQuery("#na").stop()
    jQuery("#na").animate({width:"244px",height:"152px", left:0, top:0}, 200)
});

jQuery("#na").click(function()
{
    jQuery("#na").hide()
    jQuery("#back").show()
});

so thats my code, the problem is when the click event is triggered all is fine, na dissapears but the moment you move your mouse it reappers again. I figured the problem is that the mouseout event is being triggered, but for the life of me cant figure out how to fix it. any ideas?

هل كانت مفيدة؟

المحلول

Inside the mouseout method, check if the "na" is visible or hidden. If it is hidden, dont do anything, else you can do the animate.

EDIT:

Try your mouseout method like this:

jQuery("#na").mouseout(function(){
    if(jQuery("#na").is(":visible")){
       jQuery("#na").stop()
       jQuery("#na").animate({width:"244px",height:"152px", left:0, top:0}, 200)
    }
});

نصائح أخرى

jQuery("#na").click(function(e)
{   
    e.stopPropagation();
    jQuery("#na").hide()
    jQuery("#back").show()
});

I am not sure if this would work.. Theoretically this should stop the propogation of the mous ent but i am not sure if it only stop the click event being propogated!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top