Created
May 7, 2014 19:37
-
-
Save pieplu/95af6a40570a1c70fe5b to your computer and use it in GitHub Desktop.
Toggler wanabe TogglerDelegate AUI
This file contains 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
var tableauMenu = []; | |
Y.all('.humania-main-menu-section').each(function(node){ | |
var unMenu = new Y.Toggler( | |
{ | |
animated: true, | |
container: '.humania-main-menu', | |
header: node.one('.humania-main-menu-header'), | |
content: node.one('.humania-main-menu-list'), | |
expanded: false, | |
transition: { | |
duration: 0.4, | |
easing: 'cubic-bezier(0, 0.1, 0, 1)' | |
} | |
} | |
); | |
if(node.one('.active')){ | |
unMenu.expand(); | |
} | |
tableauMenu.push(unMenu); | |
node.on('click',function(y){ | |
if(!unMenu.get('expanded')){ | |
tableauMenu.forEach(function(menuToClose){ | |
if (unMenu != menuToClose){ | |
menuToClose.collapse(); | |
} | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment