jquery.mmenu how to jump directly to a child page -
i'm using mmenu plugin jquery -- http://mmenu.frebsite.nl/
the problem i'm having when open menu, want jump page has entry best matching current breadcrumb. finding element isn't problem. example
vehicles land cars trains water dingies
i find item want display, trigger("open.mm") on it.
so if try open "land" page, works. sets "vehicles" being opened, , i'm @ page cars , trains.
however if try directly open cars page, nothing happens. sets styles on land , cars, vehicles page still 1 that's displayed.
what's trick jumping directly 3rd level page?
i've come workaround. find item in menu want open, walk menu tree , record of nodes along way, recoding them in stack. think open each menu stack in order root way menu intended open. there's visible scrolling of pages, work.
// walk , build stack of menu items open var menutoshow: jquery = this.sidemenu.find("a[href='" + besturlmatch + "']").closest("ul"); var menustoshow: jquery[] = []; { menustoshow.push(menutoshow); var linktoparent = menutoshow.find("a.mm-subclose"); menutoshow = null; if (linktoparent.length) { var parentid = linktoparent.attr("href"); menutoshow = this.sidemenu.find(parentid); if (menustoshow.length == 0) { menustoshow = null; } } } while (menutoshow != null) // open menu items starting root { menutoshow = menustoshow.pop(); menutoshow.trigger("open.mm"); } while (menustoshow.length > 0)
note need when menu opened first time on page. i'm not sure if work if sub-menu had been selected.
Comments
Post a Comment