0

This code allows me to hover over a div with class "steps-hover" and change from display: none (in my stylesheet) to display: block. Works perfect. But what if I want to change the display of a different class while hovering? That's where I am confused.

Ultimately I want to hover over the div "steps-hover", still retain the same results below but also change the css of a different div with class "default" to be display: none. Here is my current code:

function over(event) {
$('.steps-hover', this).stop(true, true, true).fadeIn(500);
$('.steps-hover', this).css("display", "normal");
}

function out(event) {
$('.steps-hover', this).stop(true, true, true).fadeOut(500);
}

So how do I add the changes to .default in there? I tried a couple different things, but no luck. My assumptions must be way off and I can't find the answer in the jquery API documentation. Thanks for any help!

0

2 Answers 2

1

Inside your over function, why not do:

$(".default").css("display", "none");
Sign up to request clarification or add additional context in comments.

2 Comments

Perfect! I tried this before, but retained the .this in there like the previous line so it wasn't working. Now I need it to return to display block on mouse out. I tried $(".default").css("display", "normal"); , but not working.
@user2574250 -- $(".default").css("display", "block"); for the mouse out :)
0

You can use too:

function over(event) {
$('.steps-hover', this).stop(true, true, true).fadeIn(500);
$('.default').hide();
}

function out(event) {
$('.steps-hover', this).stop(true, true, true).fadeOut(500);
}

1 Comment

Perfect! And I used $('.default').show(); on the out event to make it show up again. Thanks all!

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.