0

I want to add delay to the mouse out function about 1000ms thanks

$('#cart .arrow').live('mouseover', function () {
    $('#cart').addClass('active');
    $('#cart').load('index.php?route=module/cart #cart > *');

    $('#cart > .content').slideToggle('fast');
    $('#cart').live('mouseleave', function () {
        $(this).removeClass('active');
    }
});

2 Answers 2

1

Try with setTimeout

$('#cart').live('mouseleave', function () {
    setTimeout(function () {
        $(this).removeClass('active');
    }, 1000)
});
Sign up to request clarification or add additional context in comments.

Comments

0
    $('#cart').addClass('active');

    $('#cart').load('index.php?route=module/cart #cart > *');

    $('#cart > .content').slideToggle('fast');

    $('#cart').live('mouseleave', function() 
    {

      setTimeout(function()
      {
       $(this).removeClass('active'); 
      }, 5000);

    });

This will cause a delay of 5 seconds on mouse out.

2 Comments

How this answer is different from the above answer?
By the time I answered this question, it was already answered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.