Created
May 22, 2009 21:15
-
-
Save subtleGradient/116364 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // -*- Mode: MooTools Javascript; tab-width: 4; -*- | |
| // Proposed syntax. Not fully functional atm. | |
| /* | |
| EG: a menu system | |
| a menu is open while in the the menu-open state | |
| when the menu-open state is removed, the menu should be closed | |
| the menu-open state must be false 100 ms after the last mouseout even it fired | |
| */ | |
| var menuOpen = new State.Boolean('menuOpen'); | |
| var menuItems = $$('#nav .menu'); | |
| menuOpen.addEvents({ | |
| true: Elements.addClass.bind(menuItems, 'open'), | |
| false: [ | |
| Elements.removeClass.bind(menuItems, 'open'), | |
| Elements.addClass.bind(menuItems, 'closed') | |
| ] | |
| }); | |
| menuItems.addEvents({ | |
| mouseenter: menuOpen.setTrue, | |
| mouseout: menuOpen.setFalse | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment