Line 17: | Line 17: | ||
//load menu | //load menu | ||
− | $( "#load_menu_here" ).load("https://2017.igem.org/HQ:Menu #Main_menu", function | + | $( "#load_menu_here" ).load("https://2017.igem.org/HQ:Menu #Main_menu", function() { |
− | + | $('#accordion').find('.menu_item').click(function(){ | |
− | + | //Expand or collapse the panel that was clicked | |
− | + | submenu = $(this).find('.submenu'); | |
− | + | submenu.toggle(); | |
− | + | //Place the appropriate icon state on the panel that was clicked | |
− | + | icon = $(this).find('.icon'); | |
− | + | if ( !$( submenu ).is(':visible') ) { | |
− | + | icon.removeClass("less").addClass("plus"); | |
− | + | } | |
− | + | else { | |
− | + | icon.removeClass("plus").addClass("less"); | |
− | + | } | |
− | + | //Hide the other panels and switch all other icons to closed state | |
− | + | $(".submenu").not(submenu).hide(); | |
− | + | $(".icon").not(icon).removeClass("less").addClass("plus"); | |
− | + | }); | |
− | ); | + | }); |
Revision as of 15:18, 14 November 2016