Note that there are some explanatory texts on larger screens.

plurals
  1. POCustomizing a jquery script. Accordion style vertical menu for magento
    primarykey
    data
    text
    <p>I found this jquery script online and need to customize it a little. What it does is makes the vertical menu in magento have an accordion effect. It only does so for the first category though and doesn't allow you to visit it. I want to keep that but also allow lower categories to be opened in the same style but have them go to the proper page when clicked as well. I hope that made sense!</p> <p>Here is the script:</p> <pre><code>// // this script was written by Ben Frain - more info at http://www.benfrain.com // jQuery(document).ready(function(){ jQuery('ul#vertnav &gt; li &gt; ul') .click(function(e){ e.stopPropagation(); }) .hide(); //this section below prevents the first level links being followed. jQuery('ul#vertnav &gt; li').click(function(event) { event.preventDefault(); }); jQuery('ul#vertnav &gt; li, ul#vertnav &gt; li &gt; ul &gt; li').click(function(){ var selfClick = jQuery(this).find('ul:first').is(':visible'); if(!selfClick) { jQuery(this) .parent() .find('&gt; li ul:visible') .slideToggle(); } jQuery(this) .find('ul:first') .stop(true, true) .slideToggle(); }); //this section make the nereast ul section to the link show var url = window.location.toString() // this will return http://mydomain.com/pagename.html?query=xxxxxx // this bit adds a class to the active section for CSS jQuery('ul#vertnav &gt; li a').each(function(){ var myHref= jQuery(this).attr('href'); if( url.match( myHref)) { jQuery(this).addClass('activeClassNameForCSSHighlight') jQuery(this).closest('ul').show(); } }); }); </code></pre> <p>Thank you for any help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload