Skip to content

Instantly share code, notes, and snippets.

@pieplu
Created May 7, 2014 19:37
Show Gist options
  • Save pieplu/95af6a40570a1c70fe5b to your computer and use it in GitHub Desktop.
Save pieplu/95af6a40570a1c70fe5b to your computer and use it in GitHub Desktop.
Toggler wanabe TogglerDelegate AUI
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