This works well for a flat list. How would you adapt this for multiple levels of nestings of submenus. The way I ended up getting it to work was to walk the menu tree myself manually setting the selected property at each level of nesting. I couldn't find a built in way to tell the core-menu to select something at an arbitrary depth.
On Wed Feb 18 2015 at 9:23:08 AM Rob Dodson <[email protected]> wrote: > I would give each core-item a unique attribute, maybe data-target="#foo" > and give the core-menu a valueattr="data-target" attribute. Then give each > of your sections a matching id (ex: <h4 id="foo">). So as you scroll, tell > the core-menu to set it's selected property to whatever the current header > id is. That should then apply the .core-selected class to the menu item > with a matching data-target. > > On Wed, Feb 4, 2015 at 7:20 PM, <[email protected]> wrote: > >> I have an application that uses a typical pattern of core-items inside of >> core-submenus inside of a core-menu. This menu is in a drawer. My main >> content area is a very long text content based page. Clicking on any of the >> core-items, jumps you to a specific anchor in the main content. >> >> My question is how can I programmatically control which >> core-item/core-submenus are selected? I'd like to implement the pattern >> where a user scrolls the main content area to a different section and the >> core-menu selection changes in unison based on what text content is >> currently visible. I can monitor scroll events in my main window, but how >> would I change which item is selected in the core-menu? >> >> Follow Polymer on Google+: plus.google.com/107187849809354688692 >> --- >> > You received this message because you are subscribed to the Google Groups >> "Polymer" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. > > >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/polymer-dev/d1e7f133-b8d3-4341-b88b-e5a3734299c3%40googlegroups.com >> <https://groups.google.com/d/msgid/polymer-dev/d1e7f133-b8d3-4341-b88b-e5a3734299c3%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CAApOksti6oTqcDK5vVSCsz6D%3DU%2BF-pqxVXH2%2BLm-GEpOE-cckA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
