[Solved] jQuery if element is visible, what am I doing wrong?


You don’t need that if at all; and you are not using it right as described in the answer of @SLaks.
Why won’t you assign functions to an invisible element? I guess we should do that, so I think this is what you want: http://jsfiddle.net/balintbako/yuAhb/1/

 $('button.nav-mobile-switch').click(function () {
     $(this).hide();
     $('ul.site-nav.actual-navigation').show();
     return false;
 });

 $(document).click(function () {
     $('ul.site-nav.actual-navigation').hide();
     $('button.nav-mobile-switch').show();
 });


 $('ul.site-nav.actual-navigation').click(function (e) {
     e.stopPropagation();
     return false;
 });

2

solved jQuery if element is visible, what am I doing wrong?