- Toggle it before the user does on page load / DOM ready
$('#login').toggle();
. You could set it to `display: none’ in CSS but if JavaScript is disabled they’ll never see the login box.
-
See: https://css-tricks.com/dangers-stopping-event-propagation/ and there is a small section that has a snippet:
$(document).on('click', function(event) {
if (!$(event.target).closest('#menucontainer').length) {
// Hide the menus.
}
});
Which basically says “if the user didn’t click within #menucontainer
then // Hide the menus
“.
Enjoy