Hey Lloyd,
Here are some high-level steps you can follow that should get you moving in the right direction:
Through the Content tab, edit the template’s Meta-data and add the JavaScipt code into the “Additional head content” insertion point, being sure to wrap the code in script tags like so:
<script type="text/javascript">Copied code goes here</script>
For better performance, once you’ve got everything working, you will want to relocate this code into an accordionNav.js file, upload it into your site’s theme directory in the Design library, and then link your template to it using this type of pathing:
<script type="text/javascript" src="/web_resources/%7Bmy_theme%7D/%7Bjs_folder%7D/accordionNav.js"></script>
Once that’s setup, you’ll want to add the below CSS to your main style sheet. I’ve made a few tweaks to the original CSS, including making sure that the anchor tag selector is only tied to anchor tags within the Navigation widget (in the example code it styles anchor tags globally), removing the bullets from the unordered list, removing references to external background images and replacing them with very ugly – but easier to reference and modify – background colors, and generally streamlining the layout:
width: 175px;
color: #000000;
}
.accordionNav ul {
list-style-type: none;
background-color: red;
margin: 0;
padding: 0;
}
.accordionNav a {
width: auto;
line-height: 1.4em;
color: #000000;
display: block;
font: 14px Tahoma,"Lucida Grande","Trebuchet MS",Helvetica,sans-serif;
padding: 5px 2px 5px 8px;
text-decoration: none;
}
.topNav.open \> a {
background-color: blue;
}
.subNav a, .subNav.open a
{
font-family: Helvetica,Arial,Sans-Serif;
font-size: 12px;
font-weight: normal;
display: block;
padding: 5px 0 5px 8px;
position: relative;
text-decoration: none;
width: auto;
}
.subNav .active {
background-color: orange;
}
ul.subNav {
margin: 0;
padding: 0;
width: auto !important;
}
ul.subNav li:first-child {
padding-left: 10px;
}
ul.subNav li:first-child a {
font-weight: bold;
}
ul.subNav li {
background-color: green;
padding-left: 30px;
}
ul.subNav li:hover {
background-color: yellow;
} ```
Obviously this will still require heavy customization, but it should be a cleaner start.
Next, add your Navigation widget to your template, and configure it to use the **Vertical** layout (and not the Vertical Rollover, as this will activate the built in Superfish scripts and cause scripting conflicts). Next, in the Style tab, give the Navigation widget the root class of **accordionNav**. This is a big one, as neither the JavaScript nor your CSS will target this nav widget without it.
At this point you should have an ugly but functional accordion nav. Let me know if you have any trouble with this.