var myMenu = new SDMenu("main_menu"); // ID of the menu element // Default values... myMenu.speed = 3; // Menu sliding speed (1 - 5 recomended) myMenu.remember = true; // Store menu states (expanded or collapsed) in cookie and restore later myMenu.oneSmOnly = false; // One expanded submenu at a time myMenu.markCurrent = true; // Mark current link / page (link.href == location.href) myMenu.init(); // Additional methods... var firstSubmenu = myMenu.submenus[0]; myMenu.expandMenu(firstSubmenu); // Expand a submenu myMenu.collapseMenu(firstSubmenu); // Collapse a menu myMenu.toggleMenu(firstSubmenu); // Expand if collapsed and collapse if expanded myMenu.expandAll(); // Expand all submenus myMenu.collapseAll(); // Collapse all submenus
*尊重他人劳动成果,转载请自觉注明出处!注:此代码仅供学习交流,请勿用于商业用途。
一个别具特色的可折叠式效果的导航菜单,可使用不同的方式配置,如哪些子菜单默认情况下是展开的,是否使用Cookies ,以及菜单展开、折叠的速度等。非常酷!