0
$(".Arrow44").click(function(event) {
    $("#aca").slideDown();
    event.stopPropagation();
});

$(document).click(function(event) {
    var a = $(event.target).andSelf().parents("#aca");
        if (a.length == 0 && $("#aca").is(":visible")) {
    $("#aca").slideUp();
}
      else $(".Arrow44").click(function(event) {
   $("#aca").slideUp();
}


});

I am trying to accomplish an instance so that when I click on the Arrow44 element it will slideUp. But also, If I click it it will slideDown.

Can I accomplish this relatively simple with this code?

1
  • 1
    Watch your brackets. You're missing a { after else and missing a }); after the second slideUp();. Commented May 31, 2011 at 2:11

1 Answer 1

2
$(".Arrow44").click(function () {
   $("#aca").slideToggle();
   return false; // stop bubbling and prevent default action - remove if not necessary
});
Sign up to request clarification or add additional context in comments.

4 Comments

Don't forget to return false; in the click handler
@Phil: I'm not sure if it's needed (can't say for sure without looking at his code), but I added it anyways. Thanks.
Just going on the stopPropagation bit in the OP. Figured it was an anchor or button
I'm still analyzing the code. It does not seem to slideUp when I click on the original element that would make it slideDown.

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.