I am working on a huge app, that is using some sub menus, modal windows, tips, etc.
Now, what I'd like to know it the proper way to handle Esc and click outside events in such an app.
$(document).keyup(function(e) {
if (e.keyCode == 27) { ... }
});
This I use for handling Esc key press... this would be simple if there was only one event to fire...
but consider this: 1. click opens a modal window 2. click inside the modal window opens a drop down menu 3. mouseover a menu item opens a tooltip
now, when pressing Esc, first the tooltip should close, pressing again the menu should close and at last, the modal window closes
what the proper way to handle this?
Similar goes for clicking outside...
if you click outside the modal window, whole modal window should close (including menu and tooltip) clicking on modal window but outside the menu, should close the menu and the tooltip
Aucun commentaire:
Enregistrer un commentaire