Advanced menu with drop down depending on URL...

Advanced menu with drop down depending on URL...

Hey,

I am currently making a menu for a school but i have got slightly stuck :-S
I have created it from scratch which was simple but now i think i've hit a tricky bit as i couldnt find the answer anywhere on the web :'(

The menu drops like its suppose to but the client wants the menu to now stay open when they are within the drop menu and click on one of the sub-links for example if you click on 'School Information' then Headteacher's Headlines' the menu closes again, he doesn't want that.

The domain of the website is www.st-pauls.surrey.sch.uk

I know of a way doing it but it means listing each path as a variable to add and remove css classes of each div/element which could be quite a lot of code that doesn't really need to be there.

Is there anyway to do this using something like this......
  1. var pathname = window.location.pathname;
    if ("pathname:contains('school-information')") {


    $('#button_newspress_archive,#button_tech_college,#button_parent_portal,#button_transition_portal,#button_6th_form,#button_connect,#button_vacancies,#button_vle_login').css('display', 'none');
    $('#school_information_sub').css('display', 'block');
    }



    else {

    $('#school_information_sub').css('display', 'none');
    $('#button_newspress_archive,#button_tech_college,#button_parent_portal,#button_transition_portal,#button_6th_form,#button_connect,#button_vacancies,#button_vle_login').css('display', 'block');
    }
    }


The only issues I would have with the above code is how would I reset the menu to its original state if it did work.

Thanks in advance, if anyone could help me that would be really appreciated














    • Topic Participants

    • chris