开发者

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
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜