Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7997521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:59:03+00:00 2026-06-04T14:59:03+00:00

I have two seperate animations that are occurring, one fires on mouseenter the other

  • 0

I have two seperate animations that are occurring, one fires on mouseenter the other on click. The problem is that when they are both activated it creates a jumpy animation.

You can see what I mean here: JSFiddle

Is it possible to prevent the mouseenter event from occurring if the click event is activated?

Javascript

$('header h1').mouseenter(function() {
  $('header:not(.open)').delay(500).animate({
    'padding-bottom': '40px'
  }, 150, function() {
    //function complete
  });
});

$('header h1').mouseleave(function() {
  $('header:not(.open)').animate({
    'padding-bottom': '20px'
  }, 150, function() {
    //function complete
  });
});

$('header h1').click(function() {

  if ($('header').hasClass('open')) {
    $('header p').fadeOut(100);
    $('header').removeClass('open').animate({
      'padding-bottom': '20px'
    }, 300, function() {
      //animation complete
    });
  }

  else {
    $('header').addClass('open').animate({
      'padding-bottom': '150px'
    }, 300, function() {
      $('header p').fadeIn();
    });
  }

});​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:59:04+00:00Added an answer on June 4, 2026 at 2:59 pm

    Seems easier to just do this :

    $('header').on({
        mouseenter: function(e) {
            if (!$(this).is('.open')) {
                $(this).stop(true, true).delay(500).animate({'padding-bottom': '40px' }, 150, function() {
                    //function complete
                });
            }
        },
        mouseleave: function(e) {
            if (!$(this).is('.open')) {
                $(this).stop(true, true).animate({'padding-bottom': '20px'}, 150, function() {
                //function complete
                });
            }
        },
        click: function() {
            if ($(this).is('.open')) {
                $(this).find('p').fadeOut(100).end().removeClass('open').stop(true, true).animate({'padding-bottom': '20px'}, 300, function() {
                    //animation complete
                });
            }else{
                $(this).addClass('open').stop(true, true).animate({'padding-bottom': '150px'}, 300, function() {
                    $('p', this).fadeIn();
                });
            }
        }
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two seperate databases, one is production the other is test. Before LINQ,
Suppose you have two seperate ASP.NET Web Application projects that both need to use
I have a one page website that has two seperate forms that need to
The problem I have is I have two seperate AJAX requests using jQuery, One
Hello I have problem to put together animations of two separate objects to second
I have had this problem w/ two seperate WYSWYG editors in my rails application
I have a group of CFC's that I access from two seperate Applicaiton scopes.
I have two separate applications (both part of the same system) that share a
I have two functions here say animation1 and load1 they work like that: function
I have two resize functions that I would like to perform one after the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.