jQuery: checking slideToggle visibility not working?
I am trying to use slide toggle to show a sign in form and if they click outside of the box, I want that form to slide up.

I have everything running fine however my check for visibility isn't working and thus clicking outside the form container is not working.  Can you spot why?

	var loginForm = jQuery("#login .login-form");
	jQuery("#login a").click(function(e) {
		e.preventDefault();
		loginForm.slideToggle();

	});
	
    // below check isn't working why?
	if (jQuery(loginForm).is(":visible")) {
		jQuery("body").click(function() {
			jQuery(loginForm).slideUp();
		});
	}


jQuery: checking slideToggle visibility not working?
===

I am trying to use slide toggle to show a sign in form and if they click outside of the box, I want that form to slide up.

I have everything running fine however my check for visibility isn't working and thus clicking outside the form container is not working.  Can you spot why?

	var loginForm = jQuery("#login .login-form");
	jQuery("#login a").click(function(e) {
		e.preventDefault();
		loginForm.slideToggle();

	});
	
    // below check isn't working why?
	if (jQuery(loginForm).is(":visible")) {
		jQuery("body").click(function() {
			jQuery(loginForm).slideUp();
		});
	}

