jquery - SlideToggle in wordpress - only one open at a time? -
i hope can help! i've found numerous posts on slidetoggle , how show 1 div @ time, don't know how implement menu in wordpress theme bought. here theme: http://themes.themegoods.com/rhea_wp (i've hacked menu doesn't annoying fade thing (and music). see how menus stay open when click them? below code menu. possible edit code make show 1 submenu @ time? i'd others close when click on main link. maybe don't need use slidetoggle? perhaps slideup , slidedown? or else? i'm new , need fix client! appreciate help!
$j.fn.setnav = function(){ $j('#main_menu li ul').css({display: 'none'}); $j( 'ul#main_menu > li:has( ul li.current-menu-item )' ).each(function() { $j(this).find('ul.sub-menu').css({overflow:'visible', height:'auto', display: 'block'}); }); $j('ul#main_menu > li:has( ul.sub-menu )').click(function() { var $jsublist = jquery(this).find('ul:first'); $jsublist.slidetoggle('fast'); return false; }); $j('ul#main_menu > li > ul.sub-menu li ').click(function() { var suburl = $j(this).find('a:first').attr('href'); location.href=suburl; return true; }); }
Comments
Post a Comment