javascript - BigCommerce Add Active Menu Class -


i'd add css class bigcommerce left side category list when category active. how should this?

no matter have tried, can thy code below hope work.

function extractpagename(hrefstring) {     var arr = hrefstring.split('/');     return  (arr.length<2) ? hrefstring : arr[arr.length-2].tolowercase() + arr[arr.length-1].tolowercase();                }  function setactivemenu(arr, crtpage) {     (var i=0; i<arr.length; i++)     {         if(extractpagename(arr[i].href) == crtpage)         {             if (arr[i].parentnode.tagname != "div")             {                 arr[i].classname = "current";                 arr[i].parentnode.classname = "current";             }         }     } }  function setpage() {     hrefstring = document.location.href ? document.location.href : document.location;      if (document.getelementbyid("nav")!=null)         setactivemenu(document.getelementbyid("nav").getelementsbytagname("a"), extractpagename(hrefstring)); } 

dont forget add nav id menu div.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -