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 9090287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:20:22+00:00 2026-06-16T22:20:22+00:00

In the following code, the .mouseover() portion works fine, but some funny things are

  • 0

In the following code, the .mouseover() portion works fine, but some funny things are happening when .mouseleave() portion is trigged. For one, the opacity of '.step_details'is not resetting. I have tried using both .animate() and .css() to reset the opacity to 0 with no success. Any thoughts on why this might be?

$('.step').mouseover(function() {
    $(this).css({'border': 'solid #CCC 1px', 'background-color': '#FFF'})
        .animate({'margin-top': '0', height: '300px'}, 500);
    $(this).children('.step_details').css('display', 'block')
        .animate({opacity: 1},700); 
})

$('.step').mouseleave(function() {
    $(this).css({'border': 'none', 'background-color': 'inherit'})
        .animate({'margin-top': '150px', height: '150px'}, 200);
    $(this).children('.step_details').css({'display': 'none', 'opacity': 0});
})

Also, there is an inconsistent delay between the resetting of the border/background and the start of the animation that resets the top margin and the height of '.step'. This seems to imply that the opacity problem may just be a symptom of me misusing the .mouseleave() event trigger. What am I doing wrong? Is there a better way I should be doing this?

Thanks for reading!

  • 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-16T22:20:23+00:00Added an answer on June 16, 2026 at 10:20 pm

    The opacity won’t change because the animation sets display:none which is a binary switch to not show that element, any opacity changes won’t be seen. However, fadeIn and fadeOut are a good solution for what you’re doing.

    demo jsfiddle

    $('.step').hover(function() { // mouse enter
    
      $(this).animate({
          'margin-top': '0', 
          height: '300px'
      }, 500).children('.step_details').fadeIn(700);
    
    }, function() { // mouse leave
    
      $(this).animate({
        'margin-top': '150px', 
        height: '150px'
      }, 200).children('.step_details').fadeOut(200);
    
    });
    

    the border/background changes can be handled in the CSS using the :hover pseudo-class

    .step {
      margin-top:150px;
      border:none;
      background-color:#eee;
    }
    .step:hover {
      border:solid #CCC 1px;
      background-color:#fff;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the following code works fine with Opera but not with IE 8 I have
I have the following code: $('a.home-page-link').mouseover(function() { $(this).animate({ opacity: 0.4 }, 200, function()); });
with following code qTip works for me and generates tooltips: $('a.ppname[rel]').live('mouseover', function() { $(this).qtip(
Can some one explain the meaning of the following code snippet ( jQuery.fn[name] )
Following code worked fine abstract class FunctionRunnable<V> implements Runnable { protected abstract V calculate();
Following code gets executed whenever I want to persist any entity. Things seems to
Following code is a pretty simple and complete JQuery Dialog. Everything works. Problem is
Following code iterates through many data-rows, calcs some score per row and then sorts
I devised the following code for displaying a control's Tag property on mouseover. The
Have the following code: $(#blogs).mouseover( function () { $(this).addClass(hover); $(#home).removeClass(hover); $(#homepages).removeClass(hover); $(#apps).removeClass(hover); $(#facebook).removeClass(hover); $(#kontakt).removeClass(hover);

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.