1

Not sure why this is happening. When you click one my link the images from the top will slide down and if you click on one of those images they will slide back up. This works exactly how I want it to. However, when you go back and click on the link again after has already slid up, it doesnt activate the slide down on the first click. It takes two clicks. I would like it to take only one click.

http://jsfiddle.net/nategines/FzqfZ/2/

Does anyone know why this is happening? and How do I fix this and keep the sliding function the same?

1
  • to clarify: when you click on the link it expands, and if you click it again, it collapses, and this works fine. But after expanding, if you click on the image, it collapses fine, but it takes 2 clicks on the link to expands again Commented Jan 24, 2012 at 19:42

2 Answers 2

1

Edit the hide function at the end of your JS to remove the active class when you hide the thumb...

    $(".hide").click(function(){
        $(".thumb").hide(500).removeClass('active');
    });
Sign up to request clarification or add additional context in comments.

Comments

0

It hides because your if/else statement says - if item is active, then remove active and skip to end.

if($menuelement.hasClass('active'))

This code works fine if you click same menu item twice, but not if you click the images. You need to remove the active class on image click. Modify this code to fix it.

http://jsfiddle.net/FzqfZ/4/

$(".hide").click(function(){
    $(".thumb").hide(500);
    $(".active").removeClass("active");
});

1 Comment

This is a much better way to do this. Thanks for the help! I learn something new everyday!

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.