Javascript If else statement
$(".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();
}
开发者_如何学Go 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?
$(".Arrow44").click(function () {
$("#aca").slideToggle();
return false; // stop bubbling and prevent default action - remove if not necessary
});
精彩评论